]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-94052: Don't re-run failed tests with --python option (#94054)
authorChristian Heimes <christian@python.org>
Tue, 21 Jun 2022 12:42:32 +0000 (14:42 +0200)
committerGitHub <noreply@github.com>
Tue, 21 Jun 2022 12:42:32 +0000 (14:42 +0200)
Lib/test/libregrtest/cmdline.py
Lib/test/libregrtest/main.py
Lib/test/libregrtest/runtest_mp.py

index 1ac63af734c4120fd916d643e6dbda49f8ded3c5..ebe57920d9185cad8fa85b3871e9f534eb47c743 100644 (file)
@@ -1,5 +1,6 @@
 import argparse
 import os
+import shlex
 import sys
 from test.support import os_helper
 
@@ -372,8 +373,11 @@ def _parse_args(args, **kwargs):
         parser.error("-s and -f don't go together!")
     if ns.use_mp is not None and ns.trace:
         parser.error("-T and -j don't go together!")
-    if ns.python is not None and ns.use_mp is None:
-        parser.error("-p requires -j!")
+    if ns.python is not None:
+        if ns.use_mp is None:
+            parser.error("-p requires -j!")
+        # The "executable" may be two or more parts, e.g. "node python.js"
+        ns.python = shlex.split(ns.python)
     if ns.failfast and not (ns.verbose or ns.verbose3):
         parser.error("-G/--failfast needs either -v or -W")
     if ns.pgo and (ns.verbose or ns.verbose2 or ns.verbose3):
index cc8ba05d39ca7d625e5038bc2dc28b913b6a805f..655e4d2e56f8f04e72dcbd28a254e5a7e0a04364 100644 (file)
@@ -306,13 +306,22 @@ class Regrtest:
             printlist(self.skipped, file=sys.stderr)
 
     def rerun_failed_tests(self):
+        self.log()
+
+        if self.ns.python:
+            # Temp patch for https://github.com/python/cpython/issues/94052
+            self.log(
+                "Re-running failed tests is not supported with --python "
+                "host runner option."
+            )
+            return
+
         self.ns.verbose = True
         self.ns.failfast = False
         self.ns.verbose3 = False
 
         self.first_result = self.get_tests_result()
 
-        self.log()
         self.log("Re-running failed tests in verbose mode")
         rerun_list = list(self.need_rerun)
         self.need_rerun.clear()
index 71ababd19b876a99d326340529296fd81f11ae11..6ebabb86873bcb1f4954523d2cecdcf4b0df420e 100644 (file)
@@ -2,7 +2,6 @@ import faulthandler
 import json
 import os.path
 import queue
-import shlex
 import signal
 import subprocess
 import sys
@@ -59,8 +58,7 @@ def run_test_in_subprocess(testname: str, ns: Namespace, tmp_dir: str) -> subpro
     worker_args = (ns_dict, testname)
     worker_args = json.dumps(worker_args)
     if ns.python is not None:
-        # The "executable" may be two or more parts, e.g. "node python.js"
-        executable = shlex.split(ns.python)
+        executable = ns.python
     else:
         executable = [sys.executable]
     cmd = [*executable, *support.args_from_interpreter_flags(),