[Python-checkins] gh-94052: Don't re-run failed tests with --python option (GH-94054)
miss-islington
webhook-mailer at python.org
Tue Jun 21 09:07:31 EDT 2022
https://github.com/python/cpython/commit/1347607db12012f6458ffcba48d8ad797083812e
commit: 1347607db12012f6458ffcba48d8ad797083812e
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-06-21T06:07:26-07:00
summary:
gh-94052: Don't re-run failed tests with --python option (GH-94054)
(cherry picked from commit 0ff7b996f5d836e63cdaf652c7aa734285261096)
Co-authored-by: Christian Heimes <christian at python.org>
files:
M Lib/test/libregrtest/cmdline.py
M Lib/test/libregrtest/main.py
M Lib/test/libregrtest/runtest_mp.py
diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py
index 1ac63af734c41..ebe57920d9185 100644
--- a/Lib/test/libregrtest/cmdline.py
+++ b/Lib/test/libregrtest/cmdline.py
@@ -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):
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index cc8ba05d39ca7..655e4d2e56f8f 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -306,13 +306,22 @@ def list_cases(self):
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()
diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py
index 39fab5566a089..8f8c8dd918807 100644
--- a/Lib/test/libregrtest/runtest_mp.py
+++ b/Lib/test/libregrtest/runtest_mp.py
@@ -2,7 +2,6 @@
import json
import os
import queue
-import shlex
import signal
import subprocess
import sys
@@ -57,8 +56,7 @@ def run_test_in_subprocess(testname: str, ns: Namespace) -> subprocess.Popen:
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(),
More information about the Python-checkins
mailing list