diff --git a/examples/miniapps/fastapi-simple/tests.py b/examples/miniapps/fastapi-simple/tests.py index d7bd7d1f..4d80e072 100644 --- a/examples/miniapps/fastapi-simple/tests.py +++ b/examples/miniapps/fastapi-simple/tests.py @@ -7,10 +7,9 @@ from fastapi_di_example import app, container, Service @pytest.fixture -def client(event_loop): - client = AsyncClient(app=app, base_url="http://test") - yield client - event_loop.run_until_complete(client.aclose()) +async def client(event_loop): + async with AsyncClient(app=app, base_url="http://test") as client: + yield client @pytest.mark.asyncio