Skip to content

Commit 70d8b30

Browse files
tiranvstinner
authored andcommitted
pythongh-94052: Don't re-run failed tests with --python option (python#94054)
(cherry picked from commit 0ff7b99)
1 parent cb9c17d commit 70d8b30

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

Lib/test/libregrtest/cmdline.py

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

@@ -372,8 +373,11 @@ def _parse_args(args, **kwargs):
372373
parser.error("-s and -f don't go together!")
373374
if ns.use_mp is not None and ns.trace:
374375
parser.error("-T and -j don't go together!")
375-
if ns.python is not None and ns.use_mp is None:
376-
parser.error("-p requires -j!")
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)
377381
if ns.failfast and not (ns.verbose or ns.verbose3):
378382
parser.error("-G/--failfast needs either -v or -W")
379383
if ns.pgo and (ns.verbose or ns.verbose2 or ns.verbose3):

Lib/test/libregrtest/main.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,22 @@ 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+
309319
self.ns.verbose = True
310320
self.ns.failfast = False
311321
self.ns.verbose3 = False
312322

313323
self.first_result = self.get_tests_result()
314324

315-
self.log()
316325
self.log("Re-running failed tests in verbose mode")
317326
rerun_list = list(self.need_rerun)
318327
self.need_rerun.clear()

Lib/test/libregrtest/runtest_mp.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import json
33
import os.path
44
import queue
5-
import shlex
65
import signal
76
import subprocess
87
import sys
@@ -59,8 +58,7 @@ def run_test_in_subprocess(testname: str, ns: Namespace, tmp_dir: str) -> subpro
5958
worker_args = (ns_dict, testname)
6059
worker_args = json.dumps(worker_args)
6160
if ns.python is not None:
62-
# The "executable" may be two or more parts, e.g. "node python.js"
63-
executable = shlex.split(ns.python)
61+
executable = ns.python
6462
else:
6563
executable = [sys.executable]
6664
cmd = [*executable, *support.args_from_interpreter_flags(),

0 commit comments

Comments
 (0)