On 18 November 2011 01:53, Brad Crittenden <brad.critten...@canonical.com> wrote: > > On Nov 16, 2011, at 22:49 , Martin Pool wrote: >> >> Why would it return the same values? Well, there are several tests or >> functions reached from tests that reset the random seed, for instance >> test_token_creation just sets it flat out to zero. > > Actually test_token_creation is the only test that resets the seed and what > you have discovered is an error in that test. Anytime we set the seed to a > specific value it should be reseeded when done so subsequent calls to random > are not predictable. Calling random.seed() with no parameter takes pains to > do the right thing. > > I've created a branch to fix test_token_creation. > > https://code.launchpad.net/~bac/launchpad/bug-891641/+merge/82544
Actually no, there is other code reachable from the tests that resets the seed, including Mailman/LockFile.py, and model/person.py. The difference is that they save the state and restore it which, if I had the chance, is what I would have advised you to do here rather than reseeding from OS randomness. Injecting more randomness in to tests is not a good idea! It is better if things fail deterministically so that they can be understood and debugged. Even better would be to update the test so that it does not rely on the prng. -- Martin _______________________________________________ Mailing list: https://launchpad.net/~launchpad-dev Post to : launchpad-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-dev More help : https://help.launchpad.net/ListHelp