]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
regrtest: Prepend 'use' options in --{fast,slow}-ci (GH-110363)
authorZachary Ware <zach@python.org>
Sun, 15 Oct 2023 18:34:28 +0000 (13:34 -0500)
committerGitHub <noreply@github.com>
Sun, 15 Oct 2023 18:34:28 +0000 (20:34 +0200)
This allows individual resources to be disabled without having to explicitly re-enable all others.

Lib/test/libregrtest/cmdline.py
Lib/test/test_regrtest.py

index 5a01f1da7277e2f34791ff49240e639d236b1080..152b558808e66a6dfe479e2f903d4528e29dfaee 100644 (file)
@@ -417,14 +417,16 @@ def _parse_args(args, **kwargs):
     # --slow-ci has the priority
     if ns.slow_ci:
         # Similar to: -u "all" --timeout=1200
-        if not ns.use:
-            ns.use = [['all']]
+        if ns.use is None:
+            ns.use = []
+        ns.use.insert(0, ['all'])
         if ns.timeout is None:
             ns.timeout = 1200  # 20 minutes
     elif ns.fast_ci:
         # Similar to: -u "all,-cpu" --timeout=600
-        if not ns.use:
-            ns.use = [['all', '-cpu']]
+        if ns.use is None:
+            ns.use = []
+        ns.use.insert(0, ['all', '-cpu'])
         if ns.timeout is None:
             ns.timeout = 600  # 10 minutes
 
index 26c0a670241f58c19e2209bab9130caf4369b432..e65d9a89ff8a2f54c276c2bb3c3597b728606731 100644 (file)
@@ -415,9 +415,11 @@ class ParseArgsTestCase(unittest.TestCase):
         self.assertEqual(regrtest.python_cmd, ('python', '-X', 'dev'))
 
     def test_fast_ci_resource(self):
-        # it should be possible to override resources
-        args = ['--fast-ci', '-u', 'network']
-        use_resources = ['network']
+        # it should be possible to override resources individually
+        args = ['--fast-ci', '-u-network']
+        use_resources = sorted(cmdline.ALL_RESOURCES)
+        use_resources.remove('cpu')
+        use_resources.remove('network')
         self.check_ci_mode(args, use_resources)
 
     def test_slow_ci(self):