File tree Expand file tree Collapse file tree 1 file changed +1
-23
lines changed
Expand file tree Collapse file tree 1 file changed +1
-23
lines changed Original file line number Diff line number Diff line change 1717import platform
1818import random
1919import re
20- import secrets
2120import shutil
2221import string
2322import subprocess
2423import sys
2524import threading
26- import time
2725import warnings
2826from dataclasses import dataclass
2927from datetime import datetime , timedelta
30- from hashlib import sha256
3128from os import environ , linesep
3229from pathlib import Path
3330from tempfile import mkdtemp , mktemp
7269NODE_DESCRIPTION = f'{ platform .node ()} : { platform .platform ()} { platform .python_version ()} '
7370
7471
75- def get_seed () -> str :
76- """
77- Get seed for random number generator.
78-
79- The `WORKFLOW_ID` variable has to be set in the CI to uniquely identify
80- the current workflow (including the attempt)
81- """
82- seed = '' .join (
83- (
84- secrets .token_hex (),
85- str (time .time_ns ()),
86- os .getenv ('WORKFLOW_ID' , '' ),
87- NODE_DESCRIPTION ,
88- os .getenv ('PYTEST_XDIST_WORKER' , 'gw0' ),
89- )
90- )
91- return sha256 (seed .encode ()).hexdigest ()[:32 ] # 32 is the default entropy in python secrets module - 256 bits
92-
93-
94- RNG_SEED = get_seed ()
72+ RNG_SEED = os .urandom (32 ).hex ()
9573RNG = random .Random (RNG_SEED )
9674RNG_COUNTER = 0
9775
You can’t perform that action at this time.
0 commit comments