[PATCH RESEND] test: display used python hash seed

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Sat Feb 9 16:09:09 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1359505444 -3600
# Node ID 27f60febcba4f36ec23d8e6cc67be54f176eea33
# Parent  0b6e6eacc939c303136cb38af108e307d640c26e
test: display used python hash seed

We keep using a random seed for each run, but we "compute" it ourself to be able
to reproduce a failed test run.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -50,10 +50,11 @@ import shutil
 import subprocess
 import signal
 import sys
 import tempfile
 import time
+import random
 import re
 import threading
 import killdaemons as killmod
 import cPickle as pickle
 import Queue as queue
@@ -1251,11 +1252,15 @@ def main():
     os.environ['GREP_OPTIONS'] = ''
     os.environ['http_proxy'] = ''
     os.environ['no_proxy'] = ''
     os.environ['NO_PROXY'] = ''
     os.environ['TERM'] = 'xterm'
-    os.environ['PYTHONHASHSEED'] = os.environ.get('PYTHONHASHSEED', 'random')
+    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))
+        print 'python hash seed:', os.environ['PYTHONHASHSEED']
 
     # unset env related to hooks
     for k in os.environ.keys():
         if k.startswith('HG_'):
             # can't remove on solaris


More information about the Mercurial-devel mailing list