Use of random.seed(n) in tests needs cleanup

Bug #891641 reported by Brad Crittenden
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Brad Crittenden

Bug Description

In the tests test_token_creation random.seed(0) is called in order to deterministically test token generation. That's fine but it make subsequent uses of random functions predictable.

Anytime random.seed(n) is called it must be reseeded by using random.seed() which is smart enough to do the right thing.

Related branches

Revision history for this message
Martin Pool (mbp) wrote : Re: [Bug 891641] Re: Use of random.seed(n) in tests needs cleanup

For other tests, rather than randomizing the state, I would recommend
doing random.getstate and then using a cleanup to pass that back to
random.setstate. That means the test is isolated and less likely to
cause order-dependent failures.

Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
Changed in launchpad:
status: In Progress → Fix Committed
tags: added: qa-untestable
removed: qa-needstesting
William Grant (wgrant)
Changed in launchpad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.