Files
python-teos/test/common/unit/conftest.py
Sergi Delgado Segura ed8ff228d8 First commands with basic structure.
- Moves DBManager to common.
2020-04-20 17:30:15 +02:00

28 lines
565 B
Python

import pytest
import random
from shutil import rmtree
from common.db_manager import DBManager
@pytest.fixture(scope="session", autouse=True)
def prng_seed():
random.seed(0)
@pytest.fixture(scope="module")
def db_manager():
manager = DBManager("test_db")
# Add last know block for the Responder in the db
yield manager
manager.db.close()
rmtree("test_db")
def get_random_value_hex(nbytes):
pseudo_random_value = random.getrandbits(8 * nbytes)
prv_hex = "{:x}".format(pseudo_random_value)
return prv_hex.zfill(2 * nbytes)