Bug 1345109 - Ensure |mach python-test| errors out if no tests are found, r?mshal
Because test_objects was a generator, using it in the condition always returned True,
even if no tests were found. But extending test_objects to the manifest, converts it
to a list. So this patch simply moves the 'no tests' check a bit later on.
MozReview-Commit-ID: JpETWD1WQWH
--- a/python/mach_commands.py
+++ b/python/mach_commands.py
@@ -108,25 +108,25 @@ class MachCommands(MachCommandBase):
if tests:
# If we were given test paths, try to find tests matching them.
test_objects = resolver.resolve_tests(paths=tests,
flavor='python')
else:
# Otherwise just run everything in PYTHON_UNITTEST_MANIFESTS
test_objects = resolver.resolve_tests(flavor='python')
- if not test_objects:
+ mp = TestManifest()
+ mp.tests.extend(test_objects)
+
+ if not mp.tests:
message = 'TEST-UNEXPECTED-FAIL | No tests collected ' + \
'(Not in PYTHON_UNITTEST_MANIFESTS?)'
self.log(logging.WARN, 'python-test', {}, message)
return 1
- mp = TestManifest()
- mp.tests.extend(test_objects)
-
filters = []
if subsuite == 'default':
filters.append(mpf.subsuite(None))
elif subsuite:
filters.append(mpf.subsuite(subsuite))
tests = mp.active_tests(filters=filters, disabled=False, **mozinfo.info)