signalpillar / tox-battery

Experiments with Tox plugin system
MIT License
33 stars 3 forks source link

Random hash seeds break invocation with Python 3 #8

Closed Dunedan closed 7 years ago

Dunedan commented 7 years ago

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.

signalpillar commented 7 years ago

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.

https://github.com/signalpillar/tox-battery/commit/45a5ac7a842ebc16af698e72ae712ac0dc0155b0

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

signalpillar commented 7 years ago

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

Dunedan commented 7 years ago

Looks good so far. If something still pops up, I'll let you know.