From 93cb00336063168217f4c62c221127e55eea97c4 Mon Sep 17 00:00:00 2001 From: Sergi Delgado Segura Date: Wed, 22 Jan 2020 11:12:01 +0100 Subject: [PATCH] Setup seed for cli and common unit tests to random values are replicable --- test/apps/cli/unit/conftest.py | 6 ++++++ test/common/unit/conftest.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/test/apps/cli/unit/conftest.py b/test/apps/cli/unit/conftest.py index c87a930..3752ac0 100644 --- a/test/apps/cli/unit/conftest.py +++ b/test/apps/cli/unit/conftest.py @@ -1,6 +1,12 @@ +import pytest import random +@pytest.fixture(scope="session", autouse=True) +def prng_seed(): + random.seed(0) + + def get_random_value_hex(nbytes): pseudo_random_value = random.getrandbits(8 * nbytes) prv_hex = "{:x}".format(pseudo_random_value) diff --git a/test/common/unit/conftest.py b/test/common/unit/conftest.py index c87a930..3752ac0 100644 --- a/test/common/unit/conftest.py +++ b/test/common/unit/conftest.py @@ -1,6 +1,12 @@ +import pytest import random +@pytest.fixture(scope="session", autouse=True) +def prng_seed(): + random.seed(0) + + def get_random_value_hex(nbytes): pseudo_random_value = random.getrandbits(8 * nbytes) prv_hex = "{:x}".format(pseudo_random_value)