Setup seed for cli and common unit tests to random values are replicable

This commit is contained in:
Sergi Delgado Segura
2020-01-22 11:12:01 +01:00
parent 14503dcebd
commit 93cb003360
2 changed files with 12 additions and 0 deletions

View File

@@ -1,6 +1,12 @@
import pytest
import random import random
@pytest.fixture(scope="session", autouse=True)
def prng_seed():
random.seed(0)
def get_random_value_hex(nbytes): def get_random_value_hex(nbytes):
pseudo_random_value = random.getrandbits(8 * nbytes) pseudo_random_value = random.getrandbits(8 * nbytes)
prv_hex = "{:x}".format(pseudo_random_value) prv_hex = "{:x}".format(pseudo_random_value)

View File

@@ -1,6 +1,12 @@
import pytest
import random import random
@pytest.fixture(scope="session", autouse=True)
def prng_seed():
random.seed(0)
def get_random_value_hex(nbytes): def get_random_value_hex(nbytes):
pseudo_random_value = random.getrandbits(8 * nbytes) pseudo_random_value = random.getrandbits(8 * nbytes)
prv_hex = "{:x}".format(pseudo_random_value) prv_hex = "{:x}".format(pseudo_random_value)