@@ -22,6 +22,7 @@ async def no_lifespan_app(scope: Scope, receive: Callable, send: Callable) -> No
2222@pytest .mark .asyncio
2323async def test_ensure_no_race_condition () -> None :
2424 event_loop : asyncio .AbstractEventLoop = asyncio .get_running_loop ()
25+
2526 config = Config ()
2627 config .startup_timeout = 0.2
2728 lifespan = Lifespan (ASGIWrapper (no_lifespan_app ), config , event_loop )
@@ -33,6 +34,7 @@ async def test_ensure_no_race_condition() -> None:
3334@pytest .mark .asyncio
3435async def test_startup_timeout_error () -> None :
3536 event_loop : asyncio .AbstractEventLoop = asyncio .get_running_loop ()
37+
3638 config = Config ()
3739 config .startup_timeout = 0.01
3840 lifespan = Lifespan (ASGIWrapper (SlowLifespanFramework (0.02 , asyncio .sleep )), config , event_loop )
@@ -46,6 +48,7 @@ async def test_startup_timeout_error() -> None:
4648@pytest .mark .asyncio
4749async def test_startup_failure () -> None :
4850 event_loop : asyncio .AbstractEventLoop = asyncio .get_running_loop ()
51+
4952 lifespan = Lifespan (ASGIWrapper (lifespan_failure ), Config (), event_loop )
5053 lifespan_task = event_loop .create_task (lifespan .handle_lifespan ())
5154 await lifespan .wait_for_startup ()
@@ -62,6 +65,7 @@ async def return_app(scope: Scope, receive: Callable, send: Callable) -> None:
6265@pytest .mark .asyncio
6366async def test_lifespan_return () -> None :
6467 event_loop : asyncio .AbstractEventLoop = asyncio .get_running_loop ()
68+
6569 lifespan = Lifespan (ASGIWrapper (return_app ), Config (), event_loop )
6670 lifespan_task = event_loop .create_task (lifespan .handle_lifespan ())
6771 await lifespan .wait_for_startup ()
0 commit comments