[PATCH 6 of 6] run-tests: introduce --random for running tests in random error

Mads Kiilerich mads at kiilerich.com
Wed Apr 17 02:11:06 UTC 2013


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1366162894 -7200
# Node ID 0dbf64735055e8dc2118ddea7eacb76118045235
# Parent  5dbf61fe581870e2c5b3a50c39dcc5f90cc161dc
run-tests: introduce --random for running tests in random error

This is convenient when investigating failures one by one to avoid running the
same fixed tests first every time.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -198,6 +198,8 @@ def parseargs():
         help="enable Py3k warnings on Python 2.6+")
     parser.add_option('--extra-config-opt', action="append",
                       help='set the given config opt in the test hgrc')
+    parser.add_option('--random', action="store_true",
+                      help='run tests in random order')
 
     for option, (envvar, default) in defaults.items():
         defaults[option] = type(default)(os.environ.get(envvar, default))
@@ -1248,6 +1250,9 @@ def main():
 
     tests = args
 
+    if options.random:
+        random.shuffle(tests)
+
     # Reset some environment variables to well-known values so that
     # the tests produce repeatable output.
     os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C'



More information about the Mercurial-devel mailing list