summaryrefslogtreecommitdiffstats
path: root/Tools/scripts
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2011-08-01 21:48:26 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2011-08-01 21:48:26 (GMT)
commit3c01d16ed91fa77a8e70d9fa3a6c33d6290fd9c4 (patch)
tree520df41802673ee06ad4248af69c9cb7b5ab0d65 /Tools/scripts
parentb0fa4b843324ddebce03f13aa27021ed3d03332d (diff)
downloadcpython-3c01d16ed91fa77a8e70d9fa3a6c33d6290fd9c4.zip
cpython-3c01d16ed91fa77a8e70d9fa3a6c33d6290fd9c4.tar.gz
cpython-3c01d16ed91fa77a8e70d9fa3a6c33d6290fd9c4.tar.bz2
Issue #11651: Move options for running tests into a Python script.
This will be particularly useful to Windows users. run_tests.py originally written by Brett Cannon.
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-xTools/scripts/run_tests.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py
new file mode 100755
index 0000000..543afe7
--- /dev/null
+++ b/Tools/scripts/run_tests.py
@@ -0,0 +1,45 @@
+"""Run Python's test suite in a fast, rigorous way.
+
+The defaults are meant to be thorough but to skip certain resources are not
+used (by default) which can consume a lot of time and resources (e.g.,
+largefile) or can be distracting (e.g., audio and gui). These defaults
+can be overridden by simply passing a -u option to this script.
+
+"""
+
+import os
+import sys
+import test.support
+
+
+def is_multiprocess_flag(arg):
+ return arg.startswith('-j') or arg.startswith('--multiprocess')
+
+
+def is_resource_use_flag(arg):
+ return arg.startswith('-u') or arg.startswith('--use')
+
+
+def main(regrtest_args):
+ args = [sys.executable,
+ '-W', 'default', # Warnings set to 'default'
+ '-bb', # Warnings about bytes/bytearray
+ '-E', # Ignore environment variables
+ ]
+ # Allow user-specified interpreter options to override our defaults.
+ args.extend(test.support.args_from_interpreter_flags())
+ args.extend(['-m', 'test', # Run the test suite
+ '-r', # Randomize test order
+ '-w', # Re-run failed tests in verbose mode
+ ])
+ if not any(is_multiprocess_flag(arg) for arg in regrtest_args):
+ args.extend(['-j', '0']) # Use all CPU cores
+ if not any(is_resource_use_flag(arg) for arg in regrtest_args):
+ args.extend(['-u', 'all,-largefile,-audio,-gui'])
+ args.extend(regrtest_args)
+ print(' '.join(args))
+ os.execv(sys.executable, args)
+
+
+if __name__ == '__main__':
+ main(sys.argv[1:])