Skip to content

Commit 0ff7b99

Browse files
authored
gh-94052: Don't re-run failed tests with --python option (#94054)
1 parent 94eeac0 commit 0ff7b99

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

Lib/test/libregrtest/cmdline.py

Lines changed: 6 additions & 2 deletions
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

Lines changed: 10 additions & 1 deletion
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

Lines changed: 1 addition & 3 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy