File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ dev = [
3434 " pytest-mock" ,
3535 " pytest-asyncio" ,
3636 " httpx" ,
37+ " asgi-lifespan" ,
3738 " hypothesis" ,
3839 " deepdiff" ,
3940 " pytest-xdist" ,
Original file line number Diff line number Diff line change 99import pytest
1010from _pytest .config import Config
1111from _pytest .nodes import Item
12+ from asgi_lifespan import LifespanManager
1213from sqlalchemy import text
1314from sqlalchemy .ext .asyncio import AsyncConnection , AsyncEngine
1415
@@ -85,11 +86,14 @@ async def override_userdb() -> AsyncIterator[AsyncConnection]:
8586
8687 app .dependency_overrides [expdb_connection ] = override_expdb
8788 app .dependency_overrides [userdb_connection ] = override_userdb
88- async with httpx .AsyncClient (
89- transport = httpx .ASGITransport (app = app ),
90- base_url = "http://test" ,
91- follow_redirects = True ,
92- ) as client :
89+ async with (
90+ LifespanManager (app ) as manager ,
91+ httpx .AsyncClient (
92+ transport = httpx .ASGITransport (app = manager .app ),
93+ base_url = "http://test" ,
94+ follow_redirects = True ,
95+ ) as client ,
96+ ):
9397 yield client
9498
9599
You can’t perform that action at this time.
0 commit comments