[Python-checkins] Call randseed() before other imports in deccheck.py (GH-21834)

Stefan Krah webhook-mailer at python.org
Tue Aug 11 15:15:00 EDT 2020


https://github.com/python/cpython/commit/b5f87b93a542082551c67538523d318f0d46e16e
commit: b5f87b93a542082551c67538523d318f0d46e16e
branch: master
author: Stefan Krah <skrah at bytereef.org>
committer: GitHub <noreply at github.com>
date: 2020-08-11T21:14:51+02:00
summary:

Call randseed() before other imports in deccheck.py (GH-21834)

files:
M Modules/_decimal/tests/deccheck.py

diff --git a/Modules/_decimal/tests/deccheck.py b/Modules/_decimal/tests/deccheck.py
index 0b2a1c49336ef..ca869f4dbf5d8 100644
--- a/Modules/_decimal/tests/deccheck.py
+++ b/Modules/_decimal/tests/deccheck.py
@@ -30,10 +30,14 @@
 #
 
 
+import random
+import time
+
+RANDSEED = int(time.time())
+random.seed(RANDSEED)
+
 import sys
 import os
-import time
-import random
 from copy import copy
 from collections import defaultdict
 
@@ -1235,10 +1239,6 @@ def check_untested(funcdict, c_cls, p_cls):
         args.single = args.single[0]
 
 
-    randseed = int(time.time())
-    random.seed(randseed)
-
-
     # Set up the testspecs list. A testspec is simply a dictionary
     # that determines the amount of different contexts that 'test_method'
     # will generate.
@@ -1306,9 +1306,9 @@ def check_untested(funcdict, c_cls, p_cls):
     if args.multicore:
         q = Queue()
     elif args.single:
-        log("Random seed: %d", randseed)
+        log("Random seed: %d", RANDSEED)
     else:
-        log("\n\nRandom seed: %d\n\n", randseed)
+        log("\n\nRandom seed: %d\n\n", RANDSEED)
 
 
     FOUND_METHOD = False



More information about the Python-checkins mailing list