@@ -22,6 +22,7 @@ async def no_lifespan_app(scope: Scope, receive: Callable, send: Callable) -> No
22
22
@pytest .mark .asyncio
23
23
async def test_ensure_no_race_condition () -> None :
24
24
event_loop : asyncio .AbstractEventLoop = asyncio .get_running_loop ()
25
+
25
26
config = Config ()
26
27
config .startup_timeout = 0.2
27
28
lifespan = Lifespan (ASGIWrapper (no_lifespan_app ), config , event_loop )
@@ -33,6 +34,7 @@ async def test_ensure_no_race_condition() -> None:
33
34
@pytest .mark .asyncio
34
35
async def test_startup_timeout_error () -> None :
35
36
event_loop : asyncio .AbstractEventLoop = asyncio .get_running_loop ()
37
+
36
38
config = Config ()
37
39
config .startup_timeout = 0.01
38
40
lifespan = Lifespan (ASGIWrapper (SlowLifespanFramework (0.02 , asyncio .sleep )), config , event_loop )
@@ -46,6 +48,7 @@ async def test_startup_timeout_error() -> None:
46
48
@pytest .mark .asyncio
47
49
async def test_startup_failure () -> None :
48
50
event_loop : asyncio .AbstractEventLoop = asyncio .get_running_loop ()
51
+
49
52
lifespan = Lifespan (ASGIWrapper (lifespan_failure ), Config (), event_loop )
50
53
lifespan_task = event_loop .create_task (lifespan .handle_lifespan ())
51
54
await lifespan .wait_for_startup ()
@@ -62,6 +65,7 @@ async def return_app(scope: Scope, receive: Callable, send: Callable) -> None:
62
65
@pytest .mark .asyncio
63
66
async def test_lifespan_return () -> None :
64
67
event_loop : asyncio .AbstractEventLoop = asyncio .get_running_loop ()
68
+
65
69
lifespan = Lifespan (ASGIWrapper (return_app ), Config (), event_loop )
66
70
lifespan_task = event_loop .create_task (lifespan .handle_lifespan ())
67
71
await lifespan .wait_for_startup ()
0 commit comments