Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aff8c4f

Browse filesBrowse files
authored
gh-84461: Add ability for multiprocessed libregrtest to use a different Python executable (GH-91930)
1 parent b04e02c commit aff8c4f
Copy full SHA for aff8c4f

File tree

Expand file treeCollapse file tree

3 files changed

+12
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+12
-2
lines changed

‎Lib/test/libregrtest/cmdline.py

Copy file name to clipboardExpand all lines: Lib/test/libregrtest/cmdline.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ def _create_parser():
206206
group.add_argument('-S', '--start', metavar='START',
207207
help='the name of the test at which to start.' +
208208
more_details)
209+
group.add_argument('-p', '--python', metavar='PYTHON',
210+
help='Command to run Python test subprocesses with.')
209211

210212
group = parser.add_argument_group('Verbosity')
211213
group.add_argument('-v', '--verbose', action='count',
@@ -370,6 +372,8 @@ def _parse_args(args, **kwargs):
370372
parser.error("-s and -f don't go together!")
371373
if ns.use_mp is not None and ns.trace:
372374
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!")
373377
if ns.failfast and not (ns.verbose or ns.verbose3):
374378
parser.error("-G/--failfast needs either -v or -W")
375379
if ns.pgo and (ns.verbose or ns.verbose2 or ns.verbose3):

‎Lib/test/libregrtest/runtest_mp.py

Copy file name to clipboardExpand all lines: Lib/test/libregrtest/runtest_mp.py
+7-2Lines changed: 7 additions & 2 deletions
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
@@ -55,8 +56,12 @@ def run_test_in_subprocess(testname: str, ns: Namespace) -> subprocess.Popen:
5556
ns_dict = vars(ns)
5657
worker_args = (ns_dict, testname)
5758
worker_args = json.dumps(worker_args)
58-
59-
cmd = [sys.executable, *support.args_from_interpreter_flags(),
59+
if ns.python is not None:
60+
# The "executable" may be two or more parts, e.g. "node python.js"
61+
executable = shlex.split(ns.python)
62+
else:
63+
executable = [sys.executable]
64+
cmd = [*executable, *support.args_from_interpreter_flags(),
6065
'-u', # Unbuffered stdout and stderr
6166
'-m', 'test.regrtest',
6267
'--worker-args', worker_args]
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
When multiprocessing is enabled, libregrtest can now use a Python executable other than :code:`sys.executable` via the ``--python`` flag.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.