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

Augie Fackler raf at durin42.com
Tue Apr 16 22:14:08 CDT 2013


On Apr 16, 2013, at 10:11 PM, Mads Kiilerich <mads at kiilerich.com> wrote:

> # 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.

Huh? I'm not quite sure I understand the merit of this one.

> 
> 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'
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list