Skip to content

Commit b95c315

Browse files
committed
Revert "pythongh-94052: Don't re-run failed tests with --python option (pythonGH-94054)"
This reverts commit 1347607.
1 parent f8e8df3 commit b95c315

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

Lib/test/libregrtest/cmdline.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import argparse
22
import os
3-
import shlex
43
import sys
54
from test.support import os_helper
65

@@ -373,11 +372,8 @@ def _parse_args(args, **kwargs):
373372
parser.error("-s and -f don't go together!")
374373
if ns.use_mp is not None and ns.trace:
375374
parser.error("-T and -j don't go together!")
376-
if ns.python is not None:
377-
if ns.use_mp is None:
378-
parser.error("-p requires -j!")
379-
# The "executable" may be two or more parts, e.g. "node python.js"
380-
ns.python = shlex.split(ns.python)
375+
if ns.python is not None and ns.use_mp is None:
376+
parser.error("-p requires -j!")
381377
if ns.failfast and not (ns.verbose or ns.verbose3):
382378
parser.error("-G/--failfast needs either -v or -W")
383379
if ns.pgo and (ns.verbose or ns.verbose2 or ns.verbose3):

Lib/test/libregrtest/main.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -306,22 +306,13 @@ def list_cases(self):
306306
printlist(self.skipped, file=sys.stderr)
307307

308308
def rerun_failed_tests(self):
309-
self.log()
310-
311-
if self.ns.python:
312-
# Temp patch for https://github.com/python/cpython/issues/94052
313-
self.log(
314-
"Re-running failed tests is not supported with --python "
315-
"host runner option."
316-
)
317-
return
318-
319309
self.ns.verbose = True
320310
self.ns.failfast = False
321311
self.ns.verbose3 = False
322312

323313
self.first_result = self.get_tests_result()
324314

315+
self.log()
325316
self.log("Re-running failed tests in verbose mode")
326317
rerun_list = list(self.need_rerun)
327318
self.need_rerun.clear()

Lib/test/libregrtest/runtest_mp.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import os
44
import queue
5+
import shlex
56
import signal
67
import subprocess
78
import sys
@@ -56,7 +57,8 @@ def run_test_in_subprocess(testname: str, ns: Namespace) -> subprocess.Popen:
5657
worker_args = (ns_dict, testname)
5758
worker_args = json.dumps(worker_args)
5859
if ns.python is not None:
59-
executable = ns.python
60+
# The "executable" may be two or more parts, e.g. "node python.js"
61+
executable = shlex.split(ns.python)
6062
else:
6163
executable = [sys.executable]
6264
cmd = [*executable, *support.args_from_interpreter_flags(),

0 commit comments

Comments
 (0)