Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions Lib/test/libregrtest/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ def _create_parser():
group.add_argument('-S', '--start', metavar='START',
help='the name of the test at which to start.' +
more_details)
group.add_argument('-p', '--python', metavar='PYTHON',
help='Command to run Python test subprocesses with.')

group = parser.add_argument_group('Verbosity')
group.add_argument('-v', '--verbose', action='count',
Expand Down Expand Up @@ -370,6 +372,8 @@ 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.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
9 changes: 7 additions & 2 deletions Lib/test/libregrtest/runtest_mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import os
import queue
import shlex
import signal
import subprocess
import sys
Expand Down Expand Up @@ -55,8 +56,12 @@ def run_test_in_subprocess(testname: str, ns: Namespace) -> subprocess.Popen:
ns_dict = vars(ns)
worker_args = (ns_dict, testname)
worker_args = json.dumps(worker_args)

cmd = [sys.executable, *support.args_from_interpreter_flags(),
if ns.python is not None:
# The "executable" may be two or more parts, e.g. "node python.js"
executable = shlex.split(ns.python)
else:
executable = [sys.executable]
cmd = [*executable, *support.args_from_interpreter_flags(),
'-u', # Unbuffered stdout and stderr
'-m', 'test.regrtest',
'--worker-args', worker_args]
Expand Down