Seed the random fake data in the tests

This commit is contained in:
Alexander Hess 2026-12-01 15:51:24 +01:00
commit 893b6bd8f1
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -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)