Bug 1261412 - Relax test output requirement in mach python-test; r?gps
This accounts for default unittest and pytest output formatting,
in addition to mozunit.
MozReview-Commit-ID: 749CD0xQezX
--- a/python/mach_commands.py
+++ b/python/mach_commands.py
@@ -110,18 +110,21 @@ class MachCommands(MachCommandBase):
test_objects = resolver.resolve_tests(flavor='python')
for test in test_objects:
found_tests = True
f = test['path']
file_displayed_test = [] # Used as a boolean.
def _line_handler(line):
- if not file_displayed_test and line.startswith('TEST-'):
- file_displayed_test.append(True)
+ if not file_displayed_test:
+ output = ('Ran' in line or 'collected' in line or
+ line.startswith('TEST-'))
+ if output:
+ file_displayed_test.append(True)
inner_return_code = self.run_process(
[self.virtualenv_manager.python_path, f],
ensure_exit_code=False, # Don't throw on non-zero exit code.
log_name='python-test',
# subprocess requires native strings in os.environ on Windows
append_env={b'PYTHONDONTWRITEBYTECODE': str('1')},
line_handler=_line_handler)