Bug 1465887 - Allow test manifests to skip based on Python version; r?ahal draft
authorDave Hunt <dhunt@mozilla.com>
Sun, 10 Jun 2018 18:30:46 +0100
changeset 806525 b35b0cdad05a45db1e357a4fef508bb724f9db92
parent 806524 a5ab337689930348c1be1146cda50ad0720a1edb
push id112906
push userbmo:dave.hunt@gmail.com
push dateMon, 11 Jun 2018 01:42:31 +0000
reviewersahal
bugs1465887
milestone62.0a1
Bug 1465887 - Allow test manifests to skip based on Python version; r?ahal This patch allows us to enable Python 3 tests and skip any tests that fail so that we can work on adding support for Python 3 without risking regressing any existing support. It will also eventually allow us to skip tests from running against Python 2, when we decide to drop support for it. To skip a test against Python 3, add "skip-if = python == 3" to the [DEFAULT] or test file section of a manifest file. MozReview-Commit-ID: KYzjW6PQw2Q
python/mach_commands.py
--- a/python/mach_commands.py
+++ b/python/mach_commands.py
@@ -117,17 +117,18 @@ class MachCommands(MachCommandBase):
         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)
+        python = 3 if three else 2
+        tests = mp.active_tests(filters=filters, disabled=False, python=python, **mozinfo.info)
 
         if not tests:
             submsg = "for subsuite '{}' ".format(subsuite) if subsuite else ""
             message = "TEST-UNEXPECTED-FAIL | No tests collected " + \
                       "{}(Not in PYTHON_UNITTEST_MANIFESTS?)".format(submsg)
             self.log(logging.WARN, 'python-test', {}, message)
             return 1