Skip to content

Commit 3c4402f

Browse files
committed
Issue #6293: Have regrtest.py echo back sys.flags. This is done by default
in whole runs and enabled selectively using `--header` when running an explicit list of tests. Original patch by Collin Winter.
1 parent 751ba4c commit 3c4402f

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

Lib/test/regrtest.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
-d/--debug -- print traceback for failed tests
3030
-q/--quiet -- no output unless one or more tests fail
3131
-S/--slow -- print the slowest 10 tests
32+
--header -- print header with interpreter info
3233
3334
Selecting tests
3435
@@ -228,7 +229,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
228229
exclude=False, single=False, randomize=False, fromfile=None,
229230
findleaks=False, use_resources=None, trace=False, coverdir='coverage',
230231
runleaks=False, huntrleaks=False, verbose2=False, print_slow=False,
231-
random_seed=None, use_mp=None, verbose3=False, forever=False):
232+
random_seed=None, use_mp=None, verbose3=False, forever=False,
233+
header=False):
232234
"""Execute a test suite.
233235
234236
This also parses command-line options and modifies its behavior
@@ -262,7 +264,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
262264
'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir',
263265
'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=',
264266
'multiprocess=', 'slaveargs=', 'forever', 'debug', 'start=',
265-
'nowindows'])
267+
'nowindows', 'header'])
266268
except getopt.error as msg:
267269
usage(msg)
268270

@@ -371,6 +373,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
371373
forever = True
372374
elif o in ('-j', '--multiprocess'):
373375
use_mp = int(a)
376+
elif o == '--header':
377+
header = True
374378
elif o == '--slaveargs':
375379
args, kwargs = json.loads(a)
376380
try:
@@ -447,12 +451,13 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
447451
args = []
448452

449453
# For a partial run, we do not need to clutter the output.
450-
if verbose or not (quiet or single or tests or args):
454+
if verbose or header or not (quiet or single or tests or args):
451455
# Print basic platform information
452456
print("==", platform.python_implementation(), *sys.version.split())
453457
print("== ", platform.platform(aliased=True),
454458
"%s-endian" % sys.byteorder)
455459
print("== ", os.getcwd())
460+
print("Testing with flags:", sys.flags)
456461

457462
alltests = findtests(testdir, stdtests, nottests)
458463
selected = tests or args or alltests

Misc/NEWS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ Tools/Demos
121121
Updated for test discovery by Mark Roddy and Python 3 compatibility by
122122
Brian Curtin.
123123

124+
Tests
125+
-----
126+
127+
- Issue #6293: Have regrtest.py echo back sys.flags. This is done by default
128+
in whole runs and enabled selectively using ``--header`` when running an
129+
explicit list of tests. Original patch by Collin Winter.
130+
124131

125132
What's New in Python 3.2 Beta 2?
126133
================================

0 commit comments

Comments
 (0)