Random hash seeds break invocation with Python 3
Closed this issue · 3 comments
Python 3 uses a different default behavior for hash seeds than Python 2 (https://docs.python.org/3/using/cmdline.html#cmdoption-R). While with Python 2 the default is a static seed, with Python 3 it's a random one. That causes tox-battery
under Python 3 to generate different seeds for multiple invocations, because of the use of the hash
function in https://github.com/signalpillar/tox-battery/blob/master/toxbat/requirements.py#L101. That results in a re-creation of the environment, as the compared hashs always differ.
A workaround is to set PYTHONHASHSEED=0
when running tox
. That'll cause a static hash seed to be used for tox-battery
, while still using a random one per test environment. A better solution would be of course to replace the hash
function with something which returns deterministic results.
Hi Danile (@Dunedan), thank you for reporting this issue.
Good catch, your comment is absolutely valid regarding hash. I have branch that fixes this issue and one your published PR for. It is quite old and I do not understand why it is not merged in.
Unfortunately, I am able to merge/publish only in the evening. I think, I'll do it today.
Again, thanks for reminding!
Best regards,
Volodymyr
Hi Daniel (@Dunedan)
I've released a new version 0.4 that contains fix for this issue and the other one you suggested PR for.
Please give it a go and let me know whether it works for you!
I am closing this ticket so far.
Regards,
Volodymyr
Looks good so far. If something still pops up, I'll let you know.