Skip to content

Commit 9be7d57

Browse files
committed
Tweaked the test-runner random state handling to display the correct random state filename and make sure to set the same random state.
- Legacy-Id: 14209
1 parent 2c95e0e commit 9be7d57

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

ietf/utils/test_runner.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -559,16 +559,16 @@ def setup_test_environment(self, **kwargs):
559559
maybe_create_svn_symlinks(settings)
560560

561561
if os.path.exists(settings.UTILS_TEST_RANDOM_STATE_FILE):
562-
print " Loading factory-boy random state from .random-state"
563-
with open(settings.UTILS_TEST_RANDOM_STATE_FILE) as f:
564-
s = json.load(f)
565-
s[1] = tuple(s[1]) # random.setstate() won't accept a list in lieus of a tuple
566-
factory.random.set_random_state(s)
562+
print " Loading factory-boy random state from %s" % settings.UTILS_TEST_RANDOM_STATE_FILE
567563
else:
568-
print " Saving factory-boy random state to .random-state"
564+
print " Saving factory-boy random state to %s" % settings.UTILS_TEST_RANDOM_STATE_FILE
569565
with open(settings.UTILS_TEST_RANDOM_STATE_FILE, 'w') as f:
570566
s = factory.random.get_random_state()
571567
json.dump(s, f)
568+
with open(settings.UTILS_TEST_RANDOM_STATE_FILE) as f:
569+
s = json.load(f)
570+
s[1] = tuple(s[1]) # random.setstate() won't accept a list in lieu of a tuple
571+
factory.random.set_random_state(s)
572572

573573
super(IetfTestRunner, self).setup_test_environment(**kwargs)
574574

0 commit comments

Comments
 (0)