diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-14 11:15:50 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-14 11:15:50 (GMT) |
commit | a226c9100d52b3f1cefc084e9ab9b863e10655fd (patch) | |
tree | c5c7b357d0c431f93c0269f6fcd4cdab3788a36e | |
parent | 4b09b04b4d0c77acb6eeca2fa1bd4e3ab48d3a8a (diff) | |
download | cpython-a226c9100d52b3f1cefc084e9ab9b863e10655fd.zip cpython-a226c9100d52b3f1cefc084e9ab9b863e10655fd.tar.gz cpython-a226c9100d52b3f1cefc084e9ab9b863e10655fd.tar.bz2 |
Merged revisions 85469 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85469 | antoine.pitrou | 2010-10-14 13:12:00 +0200 (jeu., 14 oct. 2010) | 3 lines
Inherit interpreter flags in parallel testing
........
-rwxr-xr-x | Lib/test/regrtest.py | 8 | ||||
-rw-r--r-- | Lib/test/test_support.py | 19 |
2 files changed, 22 insertions, 5 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index fc0e823..2cc9700 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -365,9 +365,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, usage(2, "-T and -j don't go together!") if use_mp and findleaks: usage(2, "-l and -j don't go together!") - if use_mp and max(sys.flags): - # TODO: inherit the environment and the flags - print "Warning: flags and environment variables are ignored with -j option" good = [] bad = [] @@ -496,6 +493,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, ) yield (test, args_tuple) pending = tests_and_args() + opt_args = test_support.args_from_interpreter_flags() + base_cmd = [sys.executable] + opt_args + ['-m', 'test.regrtest'] def work(): # A worker thread. try: @@ -506,8 +505,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, output.put((None, None, None, None)) return # -E is needed by some tests, e.g. test_import - popen = Popen([sys.executable, '-E', '-m', 'test.regrtest', - '--slaveargs', json.dumps(args_tuple)], + popen = Popen(base_cmd + ['--slaveargs', json.dumps(args_tuple)], stdout=PIPE, stderr=PIPE, universal_newlines=True, close_fds=(os.name != 'nt')) diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 970b884..edf222d 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -1199,3 +1199,22 @@ def py3k_bytes(b): return b"".join(chr(x) for x in b) except TypeError: return bytes(b) + +def args_from_interpreter_flags(): + """Return a list of command-line arguments reproducing the current + settings in sys.flags.""" + flag_opt_map = { + 'bytes_warning': 'b', + 'dont_write_bytecode': 'B', + 'ignore_environment': 'E', + 'no_user_site': 's', + 'no_site': 'S', + 'optimize': 'O', + 'verbose': 'v', + } + args = [] + for flag, opt in flag_opt_map.items(): + v = getattr(sys.flags, flag) + if v > 0: + args.append('-' + opt * v) + return args |