Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-94052: Don't re-run failed tests with --python option #94054

Merged
python:main from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-94052: Don't re-run failed tests with --python option
Disable re-run when tests are using a `--python`` host runner process.
It's a temporary patch until we have refactored the code support
subprocesses in the re-run function.
  • Loading branch information
tiran committed Jun 21, 2022
commit adcd6f5f682797232b24ba6bfb6d57392f27776f
8 changes: 6 additions & 2 deletions Lib/test/libregrtest/cmdline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import os
import shlex
import sys
from test.support import os_helper

Expand Down Expand Up @@ -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):
Expand Down
11 changes: 10 additions & 1 deletion Lib/test/libregrtest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 1 addition & 3 deletions Lib/test/libregrtest/runtest_mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import json
import os.path
import queue
import shlex
import signal
import subprocess
import sys
Expand Down Expand Up @@ -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(),
Expand Down