Skip to content

Commit aa185d7

Browse files
committed
fix: make sure env is mocked before trying to import app
1 parent a38141d commit aa185d7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/conftest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import pytest_asyncio # pylint: disable=import-error
2424

25-
from rasenmaeher_api.web.application import get_app
2625
from rasenmaeher_api.rmsettings import switchme_to_singleton_call
2726
from rasenmaeher_api.productapihelpers import check_kraftwerk_manifest
2827
from rasenmaeher_api.testhelpers import create_test_users
@@ -36,6 +35,9 @@
3635
JWT_PATH = DATA_PATH / Path("jwt")
3736

3837

38+
# pylint: disable=W0621
39+
40+
3941
# FIXME Should the TaskMaster feature
4042
async def tms_wait() -> None:
4143
"""Wait for background tasks to avoid race conditions"""
@@ -69,8 +71,12 @@ async def taskmaster() -> AsyncGenerator[None, None]:
6971

7072

7173
@pytest.fixture(scope="session")
72-
def app_instance() -> FastAPI:
74+
def app_instance(session_env_config: None) -> FastAPI:
7375
"""Singleton app instance"""
76+
_ = session_env_config
77+
# We need to import this *after* messing with env or manifest based routes break
78+
from rasenmaeher_api.web.application import get_app # pylint: disable=import-outside-toplevel
79+
7480
app = get_app()
7581
return app
7682

0 commit comments

Comments
 (0)