test: display used python hash seed stable
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 30 Jan 2013 01:24:04 +0100
branchstable
changeset 1212 2ea362720f72
parent 1210 02c4186c3aca
child 1213 1a87bd40517c
child 1214 82697301ffa2
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. [ original upstream message ]
tests/run-tests.py
--- a/tests/run-tests.py	Wed Oct 24 23:09:31 2012 +0200
+++ b/tests/run-tests.py	Wed Jan 30 01:24:04 2013 +0100
@@ -52,6 +52,7 @@
 import sys
 import tempfile
 import time
+import random
 import re
 import threading
 import killdaemons as killmod
@@ -1253,7 +1254,11 @@
     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():