[issue31227] regrtest: reseed random with the same seed before running a test file

STINNER Victor report at bugs.python.org
Thu Aug 17 11:46:27 EDT 2017


STINNER Victor added the comment:

Antoine Pitrou: "If refleaks depend on the random seed, perhaps it's a bug worth fixing?"

I propose to change regrtest behaviour even when -R is not used, to make regrtest more deterministic.

Currently, when you run "./python -m test -r test_xxx test_yyyy", it's hard to guess the state of the RNG in test_yyy: it depends on many bytes were consumed by test_xxx. For example, if test_xxx is run on a buildbot, but skipped when I run it locally: we get a different behaviour.

I would prefer that test_yyy behaves the same when run with "./python -m test -r --randseed=5 test_xxx test_yyyy" (with test_xxx) and with "./python -m test -r --randseed=5 test_yyyy" (without test_xxx).

With my change, "./python -m test -r --randseed=5 test_yyyy test_yyyy" (sequential) and "./python -m test -r --randseed=5 -j2 test_yyyy test_yyyy" (parallel) runs test_yyy twice with the RNG in the same state.

Proposed change is part of a more global project to reduce side effects of tests, to make tests more reproductible and more "isolated".

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31227>
_______________________________________


More information about the Python-bugs-list mailing list