Seed the random fake data in the tests
This commit is contained in:
parent
e4711875ca
commit
893b6bd8f1
1 changed files with 9 additions and 0 deletions
|
|
@ -5,11 +5,13 @@ in the CLI layer need access to the database.
|
|||
"""
|
||||
|
||||
import os
|
||||
import random
|
||||
|
||||
import pytest
|
||||
import sqlalchemy as sa
|
||||
from alembic import command as alembic_cmd
|
||||
from alembic import config as alembic_config
|
||||
from factory import random as factory_random
|
||||
from sqlalchemy import orm
|
||||
|
||||
from velofy import config as pkg_config
|
||||
|
|
@ -111,3 +113,10 @@ def db_session(db_connection):
|
|||
session.close()
|
||||
|
||||
transaction.rollback()
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _seed_random() -> None:
|
||||
"""Make the fake data reproducible across test runs."""
|
||||
random.seed(42)
|
||||
factory_random.reseed_random(42)
|
||||
|
|
|
|||
Loading…
Reference in a new issue