Bug 1345109 - Ensure |mach python-test| errors out if no tests are found, r=mshal
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 07 Mar 2017 10:55:07 -0500
changeset 346542 233d22402d7a65be5e9ac62141189ed70d182b88
parent 346541 8047ccbd2b9831b674d1a7f1872cd0537933098b
child 346543 2324b5d27792b17e19afe42d70c224deb52565aa
push id31471
push userkwierso@gmail.com
push dateThu, 09 Mar 2017 00:43:50 +0000
treeherdermozilla-central@193989276571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1345109
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
python/mach_commands.py
--- 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)