diff --git a/pytest.ini b/pytest.ini index 36d842ae..5446becc 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,5 +2,6 @@ DJANGO_SETTINGS_MODULE = khoj.app.settings pythonpath = . src testpaths = tests +addopts = --reuse-db --nomigrations markers = chatquality: marks tests as chatquality (deselect with '-m "not chatquality"') diff --git a/tests/conftest.py b/tests/conftest.py index e5ab3a8e..d1135c0c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -50,6 +50,13 @@ def enable_db_access_for_all_tests(db): pass +@pytest.fixture(scope="session", autouse=True) +def django_db_setup(django_db_setup, django_db_blocker): + """Ensure proper database setup and teardown for all tests.""" + with django_db_blocker.unblock(): + yield + + @pytest.fixture(scope="session") def search_config() -> SearchConfig: state.embeddings_model = dict()