summaryrefslogtreecommitdiffstats
path: root/Lib/test/support.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-10-14 11:12:00 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-10-14 11:12:00 (GMT)
commit1b03f2ca83d6232845c2dadf47c2e15b32c1d906 (patch)
tree91c6df7fdce2e33a6d8fc33461d5dbeb16737f71 /Lib/test/support.py
parent9a6692f6d7784365ae07094694c754d2b153b719 (diff)
downloadcpython-1b03f2ca83d6232845c2dadf47c2e15b32c1d906.zip
cpython-1b03f2ca83d6232845c2dadf47c2e15b32c1d906.tar.gz
cpython-1b03f2ca83d6232845c2dadf47c2e15b32c1d906.tar.bz2
Inherit interpreter flags in parallel testing
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r--Lib/test/support.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index 08ce0a0..1f69317 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -1327,3 +1327,22 @@ def strip_python_stderr(stderr):
"""
stderr = re.sub(br"\[\d+ refs\]\r?\n?$", b"", stderr).strip()
return stderr
+
+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