(repo, number)
| 162 | |
| 163 | |
| 164 | def do_thing(repo, number): |
| 165 | cmd = f"travis show -r {repo} {number or ''}" |
| 166 | # cmd = f"travis show --com -r {repo} {number or ''}" |
| 167 | print(cmd) |
| 168 | |
| 169 | exitcode = 0 |
| 170 | # For offline testing |
| 171 | output = """Build #4: Upgrade Python syntax with pyupgrade https://github.com/asottile/pyupgrade |
| 172 | State: passed |
| 173 | Type: push |
| 174 | Branch: add-3.7 |
| 175 | Compare URL: https://github.com/hugovk/diff-cover/compare/4ae7cf97c6fa...7eeddb300175 |
| 176 | Duration: 16 min 7 sec |
| 177 | Started: 2018-10-17 19:03:01 |
| 178 | Finished: 2018-10-17 19:09:53 |
| 179 | |
| 180 | #4.1 passed: 1 min os: linux, env: TOXENV=py27, python: 2.7 |
| 181 | #4.2 passed: 1 min 43 sec os: linux, env: TOXENV=py34, python: 3.4 |
| 182 | #4.3 passed: 1 min 52 sec os: linux, env: TOXENV=py35, python: 3.5 |
| 183 | #4.4 passed: 1 min 38 sec os: linux, env: TOXENV=py36, python: 3.6 |
| 184 | #4.5 passed: 1 min 47 sec os: linux, env: TOXENV=py37, python: 3.7 |
| 185 | #4.6 passed: 4 min 35 sec os: linux, env: TOXENV=pypy, python: pypy |
| 186 | #4.7 passed: 3 min 17 sec os: linux, env: TOXENV=pypy3, python: pypy3""" |
| 187 | |
| 188 | # For offline testing |
| 189 | output = """Build #9: :arrows_clockwise: [EngCom] Public Pull Requests - 2.3-develop |
| 190 | State: errored |
| 191 | Type: push |
| 192 | Branch: 2.3-develop |
| 193 | Compare URL: https://github.com/hugovk/magento2/compare/80469a61e061...77af5d65ef4f |
| 194 | Duration: 4 hrs 12 min 13 sec |
| 195 | Started: 2018-10-27 17:50:51 |
| 196 | Finished: 2018-10-27 18:54:14 |
| 197 | |
| 198 | #9.1 passed: 3 min 30 sec os: linux, env: TEST_SUITE=unit, php: 7.1 |
| 199 | #9.2 passed: 3 min 35 sec os: linux, env: TEST_SUITE=unit, php: 7.2 |
| 200 | #9.3 passed: 3 min 41 sec os: linux, env: TEST_SUITE=static, php: 7.2 |
| 201 | #9.4 passed: 8 min 48 sec os: linux, env: TEST_SUITE=js GRUNT_COMMAND=spec, php: 7.2 |
| 202 | #9.5 passed: 3 min 24 sec os: linux, env: TEST_SUITE=js GRUNT_COMMAND=static, php: 7.2 |
| 203 | #9.6 errored: 50 min os: linux, env: TEST_SUITE=integration INTEGRATION_INDEX=1, php: 7.1 |
| 204 | #9.7 passed: 49 min 25 sec os: linux, env: TEST_SUITE=integration INTEGRATION_INDEX=1, php: 7.2 |
| 205 | #9.8 passed: 31 min 54 sec os: linux, env: TEST_SUITE=integration INTEGRATION_INDEX=2, php: 7.1 |
| 206 | #9.9 passed: 31 min 24 sec os: linux, env: TEST_SUITE=integration INTEGRATION_INDEX=2, php: 7.2 |
| 207 | #9.10 passed: 27 min 23 sec os: linux, env: TEST_SUITE=integration INTEGRATION_INDEX=3, php: 7.1 |
| 208 | #9.11 passed: 26 min 9 sec os: linux, env: TEST_SUITE=integration INTEGRATION_INDEX=3, php: 7.2 |
| 209 | #9.12 passed: 13 min os: linux, env: TEST_SUITE=functional, php: 7.2""" |
| 210 | |
| 211 | # Real use |
| 212 | exitcode, output = subprocess.getstatusoutput(cmd) |
| 213 | |
| 214 | # print(exitcode) |
| 215 | # print(output) |
| 216 | if exitcode != 0: |
| 217 | print(output) |
| 218 | sys.exit(exitcode) |
| 219 | |
| 220 | minutes = [] |
| 221 | matches = re.findall(r"(pass|fail|error)ed.* (\d+) min (\d+)? ", output) |
no test coverage detected