Skip to content

Commit f9c6bce

Browse files
committed
refactor
1 parent 86994d8 commit f9c6bce

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

services/director-v2/tests/conftest.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,6 @@ def mock_env(
196196
)
197197

198198

199-
@pytest.fixture()
200-
async def client(mock_env: EnvVarsDict) -> AsyncIterator[TestClient]:
201-
settings = AppSettings.create_from_envs()
202-
app = init_app(settings)
203-
print("Application settings\n", settings.model_dump_json(indent=2))
204-
# NOTE: this way we ensure the events are run in the application
205-
# since it starts the app on a test server
206-
with TestClient(app, raise_server_exceptions=True) as test_client:
207-
yield test_client
208-
209-
210199
@pytest.fixture()
211200
async def initialized_app(mock_env: EnvVarsDict) -> AsyncIterable[FastAPI]:
212201
settings = AppSettings.create_from_envs()
@@ -216,6 +205,14 @@ async def initialized_app(mock_env: EnvVarsDict) -> AsyncIterable[FastAPI]:
216205
yield app
217206

218207

208+
@pytest.fixture()
209+
async def client(initialized_app: FastAPI) -> AsyncIterator[TestClient]:
210+
# NOTE: this way we ensure the events are run in the application
211+
# since it starts the app on a test server
212+
with TestClient(initialized_app, raise_server_exceptions=True) as test_client:
213+
yield test_client
214+
215+
219216
@pytest.fixture()
220217
async def async_client(initialized_app: FastAPI) -> AsyncIterable[httpx.AsyncClient]:
221218
async with httpx.AsyncClient(

0 commit comments

Comments
 (0)