]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] regrtest: Prepend 'use' options in --{fast,slow}-ci (GH-110363) (#110924)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 16 Oct 2023 14:55:52 +0000 (16:55 +0200)
committerGitHub <noreply@github.com>
Mon, 16 Oct 2023 14:55:52 +0000 (14:55 +0000)
regrtest: Prepend 'use' options in --{fast,slow}-ci (GH-110363)

This allows individual resources to be disabled without having to explicitly re-enable all others.
(cherry picked from commit b75186f69edcf54615910a5cd707996144163ef7)

Co-authored-by: Zachary Ware <zach@python.org>
Lib/test/libregrtest/cmdline.py
Lib/test/test_regrtest.py

index dd4cd335bef7e3e31ca6c8f44efd0ffa71283e4c..b1b00893402d8e2ee78c606c9a3e88eefcb5ed69 100644 (file)
@@ -418,14 +418,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 45573a2719c5437b10f0fed3bae56d781142549f..c8e182397c835e5c6837dc741053a4223d66ca80 100644 (file)
@@ -416,9 +416,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):