2026-08-15 13:50:24 +07:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
import django
|
|
|
|
|
import pytest
|
|
|
|
|
from django.core.management import call_command
|
|
|
|
|
|
|
|
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "artifex.test_settings")
|
|
|
|
|
django.setup()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
2026-08-28 23:51:02 +07:00
|
|
|
def migrated_database(django_db_blocker):
|
|
|
|
|
with django_db_blocker.unblock():
|
|
|
|
|
call_command("migrate", verbosity=0, interactive=False)
|
2026-08-15 13:50:24 +07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
2026-08-28 23:51:02 +07:00
|
|
|
def clean_database(migrated_database, django_db_blocker):
|
|
|
|
|
with django_db_blocker.unblock():
|
|
|
|
|
call_command("flush", verbosity=0, interactive=False)
|
|
|
|
|
yield
|