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
This commit is contained in:
Andrew Halberstadt
2017-03-07 10:55:07 -05:00
parent a1d1ec6c46
commit 87d047232c

View File

@@ -113,15 +113,15 @@ class MachCommands(MachCommandBase):
# 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))