Skip to content

Commit 821d168

Browse files
committed
parse pytest test counts in runtests
1 parent f3d1fc7 commit 821d168

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

mypy/waiter.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,18 @@ def parse_test_stats_from_output(output: str, fail_type: Optional[str]) -> Tuple
281281
Return tuple (number of tests, number of test failures). Default
282282
to the entire task representing a single test as a fallback.
283283
"""
284+
285+
# pytest
286+
m = re.search('^=+ (.*) in [0-9.]+ seconds =+\n\Z', output, re.MULTILINE)
287+
if m:
288+
counts = {}
289+
for part in m.group(1).split(', '): # e.g., '3 failed, 32 passed, 345 deselected'
290+
count, key = part.split()
291+
counts[key] = int(count)
292+
return (sum(c for k, c in counts.items() if k != 'deselected'),
293+
counts.get('failed', 0))
294+
295+
# myunit
284296
m = re.search('^([0-9]+)/([0-9]+) test cases failed(, ([0-9]+) skipped)?.$', output,
285297
re.MULTILINE)
286298
if m:
@@ -289,6 +301,7 @@ def parse_test_stats_from_output(output: str, fail_type: Optional[str]) -> Tuple
289301
re.MULTILINE)
290302
if m:
291303
return int(m.group(1)), 0
304+
292305
# Couldn't find test counts, so fall back to single test per tasks.
293306
if fail_type is not None:
294307
return 1, 1

0 commit comments

Comments
 (0)