[PATCH 075 of 179 tests-refactor] run-tests: move hash seed logic to TestRunner
Gregory Szorc
gregory.szorc at gmail.com
Fri May 2 18:38:32 UTC 2014
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1398013141 25200
# Sun Apr 20 09:59:01 2014 -0700
# Branch stable
# Node ID 335f0364ed5aee334971d46f7fa95c4ece17b732
# Parent 294b4e4d280cdedb9a01b4887272d39fe0c848f4
run-tests: move hash seed logic to TestRunner
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1019,16 +1019,21 @@ class TestRunner(object):
oldenv = dict(os.environ)
try:
return self._run(tests)
finally:
os.environ.clear()
os.environ.update(oldenv)
def _run(self, tests):
+ if 'PYTHONHASHSEED' not in os.environ:
+ # use a random python hash seed all the time
+ # we do the randomness ourself to know what seed is used
+ os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32))
+
if self.options.tmpdir:
self.options.keep_tmpdir = True
tmpdir = self.options.tmpdir
if os.path.exists(tmpdir):
# Meaning of tmpdir has changed since 1.3: we used to create
# HGTMP inside tmpdir; now HGTMP is tmpdir. So fail if
# tmpdir already exists.
print "error: temp dir %r already exists" % tmpdir
@@ -1456,19 +1461,14 @@ def main(args, runner=None, parser=None)
raise
return -1e9 # file does not exist, tell early
for kw in slow:
if kw in f:
val *= 10
return val
tests.sort(key=sortkey)
- if 'PYTHONHASHSEED' not in os.environ:
- # use a random python hash seed all the time
- # we do the randomness ourself to know what seed is used
- os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32))
-
runner.testdir = os.environ['TESTDIR'] = os.getcwd()
return runner.run(tests)
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
More information about the Mercurial-devel
mailing list