[TIP] question re: tox and PYTHONHASHSEED

Chris Jerdonek chris.jerdonek at gmail.com
Wed Sep 25 15:53:29 PDT 2013

I have a question about tox.  What options do I have for setting
PYTHONHASHSEED [1] to an explicit random integer value prior to each
tox test run?

Specifically, my tox command calls a Python test script generated from
a setup.py console_script entry_point.  For debugging purposes, my
test script displays the value of PYTHONHASHSEED at the beginning of
each test run.  If PYTHONHASHSEED is an integer as opposed to
"random", this lets me re-run the tests with the same hash seed.

I would like to set PYTHONHASHSEED to a random integer for each tox
test run.  When running tests from source (without tox), I can do this
using a wrapper shell script that sets PYTHONHASHSEED as follows prior
to calling the Python script:


What options do I have for doing something similar with tox?  For
example, it would be nice to be able to do something like the
following in my tox.ini:

    setenv =


[1] http://docs.python.org/2/using/cmdline.html#envvar-PYTHONHASHSEED

More information about the testing-in-python mailing list