Mercurial > hg
comparison tests/run-tests.py @ 19057:3d265e0822d3
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.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 17 Apr 2013 03:41:34 +0200 |
parents | 05d544d17fa2 |
children | 75031762aff2 |
comparison
equal
deleted
inserted
replaced
19056:ac41bb76c737 | 19057:3d265e0822d3 |
---|---|
196 "temporary installation") | 196 "temporary installation") |
197 parser.add_option("-3", "--py3k-warnings", action="store_true", | 197 parser.add_option("-3", "--py3k-warnings", action="store_true", |
198 help="enable Py3k warnings on Python 2.6+") | 198 help="enable Py3k warnings on Python 2.6+") |
199 parser.add_option('--extra-config-opt', action="append", | 199 parser.add_option('--extra-config-opt', action="append", |
200 help='set the given config opt in the test hgrc') | 200 help='set the given config opt in the test hgrc') |
201 parser.add_option('--random', action="store_true", | |
202 help='run tests in random order') | |
201 | 203 |
202 for option, (envvar, default) in defaults.items(): | 204 for option, (envvar, default) in defaults.items(): |
203 defaults[option] = type(default)(os.environ.get(envvar, default)) | 205 defaults[option] = type(default)(os.environ.get(envvar, default)) |
204 parser.set_defaults(**defaults) | 206 parser.set_defaults(**defaults) |
205 (options, args) = parser.parse_args() | 207 (options, args) = parser.parse_args() |
1246 if len(args) == 0: | 1248 if len(args) == 0: |
1247 args = sorted(os.listdir(".")) | 1249 args = sorted(os.listdir(".")) |
1248 | 1250 |
1249 tests = args | 1251 tests = args |
1250 | 1252 |
1253 if options.random: | |
1254 random.shuffle(tests) | |
1255 | |
1251 # Reset some environment variables to well-known values so that | 1256 # Reset some environment variables to well-known values so that |
1252 # the tests produce repeatable output. | 1257 # the tests produce repeatable output. |
1253 os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C' | 1258 os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C' |
1254 os.environ['TZ'] = 'GMT' | 1259 os.environ['TZ'] = 'GMT' |
1255 os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>" | 1260 os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>" |