Commit 3c4402f8 authored by Antoine Pitrou's avatar Antoine Pitrou

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.
parent 751ba4cf
...@@ -29,6 +29,7 @@ Verbosity ...@@ -29,6 +29,7 @@ Verbosity
-d/--debug -- print traceback for failed tests -d/--debug -- print traceback for failed tests
-q/--quiet -- no output unless one or more tests fail -q/--quiet -- no output unless one or more tests fail
-S/--slow -- print the slowest 10 tests -S/--slow -- print the slowest 10 tests
--header -- print header with interpreter info
Selecting tests Selecting tests
...@@ -228,7 +229,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, ...@@ -228,7 +229,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
exclude=False, single=False, randomize=False, fromfile=None, exclude=False, single=False, randomize=False, fromfile=None,
findleaks=False, use_resources=None, trace=False, coverdir='coverage', findleaks=False, use_resources=None, trace=False, coverdir='coverage',
runleaks=False, huntrleaks=False, verbose2=False, print_slow=False, runleaks=False, huntrleaks=False, verbose2=False, print_slow=False,
random_seed=None, use_mp=None, verbose3=False, forever=False): random_seed=None, use_mp=None, verbose3=False, forever=False,
header=False):
"""Execute a test suite. """Execute a test suite.
This also parses command-line options and modifies its behavior This also parses command-line options and modifies its behavior
...@@ -262,7 +264,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, ...@@ -262,7 +264,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir',
'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=', 'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=',
'multiprocess=', 'slaveargs=', 'forever', 'debug', 'start=', 'multiprocess=', 'slaveargs=', 'forever', 'debug', 'start=',
'nowindows']) 'nowindows', 'header'])
except getopt.error as msg: except getopt.error as msg:
usage(msg) usage(msg)
...@@ -371,6 +373,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, ...@@ -371,6 +373,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
forever = True forever = True
elif o in ('-j', '--multiprocess'): elif o in ('-j', '--multiprocess'):
use_mp = int(a) use_mp = int(a)
elif o == '--header':
header = True
elif o == '--slaveargs': elif o == '--slaveargs':
args, kwargs = json.loads(a) args, kwargs = json.loads(a)
try: try:
...@@ -447,12 +451,13 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, ...@@ -447,12 +451,13 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
args = [] args = []
# For a partial run, we do not need to clutter the output. # For a partial run, we do not need to clutter the output.
if verbose or not (quiet or single or tests or args): if verbose or header or not (quiet or single or tests or args):
# Print basic platform information # Print basic platform information
print("==", platform.python_implementation(), *sys.version.split()) print("==", platform.python_implementation(), *sys.version.split())
print("== ", platform.platform(aliased=True), print("== ", platform.platform(aliased=True),
"%s-endian" % sys.byteorder) "%s-endian" % sys.byteorder)
print("== ", os.getcwd()) print("== ", os.getcwd())
print("Testing with flags:", sys.flags)
alltests = findtests(testdir, stdtests, nottests) alltests = findtests(testdir, stdtests, nottests)
selected = tests or args or alltests selected = tests or args or alltests
......
...@@ -121,6 +121,13 @@ Tools/Demos ...@@ -121,6 +121,13 @@ Tools/Demos
Updated for test discovery by Mark Roddy and Python 3 compatibility by Updated for test discovery by Mark Roddy and Python 3 compatibility by
Brian Curtin. Brian Curtin.
Tests
-----
- 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.
What's New in Python 3.2 Beta 2? What's New in Python 3.2 Beta 2?
================================ ================================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment