Bug 1261412 - Relax test output requirement in mach python-test; r?gps draft
authorMaja Frydrychowicz <mjzffr@gmail.com>
Thu, 14 Apr 2016 13:06:47 -0400
changeset 352718 77eb1b76fd17fdba33890efc57bc279044bb31db
parent 352717 08801affc238fa8bb7213cd0f6faa1359b696605
child 352719 a155170449465cc045e38a3142417d0952e98a33
push id15758
push usermjzffr@gmail.com
push dateMon, 18 Apr 2016 14:42:55 +0000
reviewersgps
bugs1261412
milestone48.0a1
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
python/mach_commands.py
--- 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)