diff --git a/greg/tests/api/test_person.py b/greg/tests/api/test_person.py index a2ee1249e657db801a3f1a9d3d757efe60849853..0da8f3d2a4943e27bfd1b144db16cf04022b268e 100644 --- a/greg/tests/api/test_person.py +++ b/greg/tests/api/test_person.py @@ -7,7 +7,6 @@ from rest_framework.status import HTTP_200_OK from rest_framework.test import APIClient from greg.models import Person -from greg.tests.populate_database import DatabasePopulation @pytest.fixture @@ -41,17 +40,6 @@ def person_bar() -> Person: ) -# The database is populated once when scope is session. -# If the scope is changed to function some additional -# logic is needed to make sure the old data is cleaned -# before the seeding is run again -@pytest.fixture(scope="session") -def setup_db_test_data(django_db_setup, django_db_blocker): - with django_db_blocker.unblock(): - database_seeder = DatabasePopulation() - database_seeder.populate_database() - - @pytest.mark.django_db def test_get_person(client, person_foo): resp = client.get(reverse("person-detail", kwargs={"id": person_foo.id})) diff --git a/greg/tests/conftest.py b/greg/tests/conftest.py index 9817637eedc67bee90e9fee764e1d99456c82ea0..290c0a14a871798caed88c5157ac86b2d20a7122 100644 --- a/greg/tests/conftest.py +++ b/greg/tests/conftest.py @@ -3,4 +3,19 @@ import logging # faker spams the logs with localisation warnings # see https://github.com/joke2k/faker/issues/753 +import pytest + +from greg.tests.populate_database import DatabasePopulation + logging.getLogger("faker").setLevel(logging.ERROR) + + +# The database is populated once when scope is session. +# If the scope is changed to function some additional +# logic is needed to make sure the old data is cleaned +# before the seeding is run again +@pytest.fixture(scope="session") +def setup_db_test_data(django_db_setup, django_db_blocker): + with django_db_blocker.unblock(): + database_seeder = DatabasePopulation() + database_seeder.populate_database()