Bug 1317970 - Filter python unittests through manifestparser.active_tests, r?chmanchester
The build system's TestResolver does a pretty good job of getting the right manifestparser
based tests to run, but it isn't perfect. Notably, it ignores the 'disabled' key. We filter
the tests through manifestparser here to make sure the build system didn't miss anything.
For context, this is also what the other test harnesses (e.g mochitest) do as well.
MozReview-Commit-ID: FaHb4nvuoK9
--- a/python/mach_commands.py
+++ b/python/mach_commands.py
@@ -10,16 +10,19 @@ import mozpack.path as mozpath
import os
from concurrent.futures import (
ThreadPoolExecutor,
as_completed,
thread,
)
+import mozinfo
+from manifestparser import TestManifest
+
from mozbuild.base import (
MachCommandBase,
)
from mach.decorators import (
CommandArgument,
CommandProvider,
Command,
@@ -123,24 +126,28 @@ class MachCommands(MachCommandBase):
if not test_objects:
message = 'TEST-UNEXPECTED-FAIL | No tests collected'
if not path_only:
message += ' (Not in PYTHON_UNITTEST_MANIFESTS? Try --path-only?)'
self.log(logging.WARN, 'python-test', {}, message)
return 1
+ mp = TestManifest()
+ mp.tests.extend(test_objects)
+ tests = mp.active_tests(disabled=False, **mozinfo.info)
+
self.jobs = jobs
self.terminate = False
self.verbose = verbose
return_code = 0
with ThreadPoolExecutor(max_workers=self.jobs) as executor:
futures = [executor.submit(self._run_python_test, test['path'])
- for test in test_objects]
+ for test in tests]
try:
for future in as_completed(futures):
output, ret = future.result()
for line in output:
self.log(logging.INFO, 'python-test', {'line': line.rstrip()}, '{line}')