[PATCH 6 of 6] run-tests.py: inherit PYTHONHASHSEED from environment if set

Mads Kiilerich mads at kiilerich.com
Sun Jan 20 07:18:09 CST 2013


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1358687872 -3600
# Branch stable
# Node ID f62e594f1b67ea617c8d727834ee8c9895efe4ef
# Parent  a0e2208420d688baa24bb52d9064e139a9dcc885
run-tests.py: inherit PYTHONHASHSEED from environment if set

This makes it possible to fix the seed by using for instance
  PYTHONHASHSEED=7 ./run-tests.py ...

This can be very convenient when trying to debug problems that are influenced
by hash values. Try different seed values until you find one that triggers the
bad behaviour and then keep that while debugging.

It could also to some extent make sense for buildbots to set (different) fixed
values to make sure the test execution is stable.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1252,7 +1252,7 @@ def main():
     os.environ['no_proxy'] = ''
     os.environ['NO_PROXY'] = ''
     os.environ['TERM'] = 'xterm'
-    os.environ['PYTHONHASHSEED'] = 'random'
+    os.environ['PYTHONHASHSEED'] = os.environ.get('PYTHONHASHSEED', 'random')
 
     # unset env related to hooks
     for k in os.environ.keys():


More information about the Mercurial-devel mailing list