[TIP] question re: tox and PYTHONHASHSEED
chris.jerdonek at gmail.com
Wed Sep 25 18:29:49 PDT 2013
On Wed, Sep 25, 2013 at 3:53 PM, Chris Jerdonek
<chris.jerdonek at gmail.com> wrote:
> I have a question about tox. What options do I have for setting
> PYTHONHASHSEED  to an explicit random integer value prior to each
> tox test run?
By the way, I tried the following two work-arounds in my tox.ini, and
export PYTHONHASHSEED=$RANDOM && run_tests
py33 runtests: commands | export PYTHONHASHSEED=$RANDOM && run_tests
ERROR: InvocationError: could not find executable 'export'
echo "foo" && export PYTHONHASHSEED=$RANDOM && run_tests
py33 runtests: commands | echo foo && export PYTHONHASHSEED=$RANDOM
WARNING:test command found but not installed in testenv
Maybe forgot to specify a dependency?
foo && export PYTHONHASHSEED=$RANDOM && run-tests
In the latter example, it is "echoing" the rest of the command.
> 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:
> export PYTHONHASHSEED=$RANDOM
> 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 =
> PYTHONHASHSEED = $RANDOM
>  http://docs.python.org/2/using/cmdline.html#envvar-PYTHONHASHSEED
More information about the testing-in-python