File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -219,9 +219,11 @@ async def test_no_handler_cancellation(aiohttp_unused_port) -> None:
219219 timeout_event = asyncio .Event ()
220220 done_event = asyncio .Event ()
221221 port = aiohttp_unused_port ()
222+ started = False
222223
223224 async def on_request (_ : web .Request ) -> web .Response :
224- nonlocal done_event , timeout_event
225+ nonlocal done_event , started , timeout_event
226+ started = True
225227 await asyncio .wait_for (timeout_event .wait (), timeout = 5 )
226228 done_event .set ()
227229 return web .Response ()
@@ -238,7 +240,7 @@ async def on_request(_: web.Request) -> web.Response:
238240
239241 try :
240242 async with client .ClientSession (
241- timeout = client .ClientTimeout (total = 0.1 )
243+ timeout = client .ClientTimeout (total = 0.2 )
242244 ) as sess :
243245 with pytest .raises (asyncio .TimeoutError ):
244246 await sess .get (f"http://localhost:{ port } /" )
@@ -247,6 +249,7 @@ async def on_request(_: web.Request) -> web.Response:
247249
248250 with suppress (asyncio .TimeoutError ):
249251 await asyncio .wait_for (done_event .wait (), timeout = 1 )
252+ assert started
250253 assert done_event .is_set ()
251254 finally :
252255 await asyncio .gather (runner .shutdown (), site .stop ())
Original file line number Diff line number Diff line change @@ -93,13 +93,13 @@ async def test_access_root_of_static_handler(
9393 client = await aiohttp_client (app )
9494
9595 # Request the root of the static directory.
96- r = await client .get (prefix )
97- assert r .status == status
96+ async with await client .get (prefix ) as r :
97+ assert r .status == status
9898
99- if data :
100- assert r .headers ["Content-Type" ] == "text/html; charset=utf-8"
101- read_ = await r .read ()
102- assert read_ == data
99+ if data :
100+ assert r .headers ["Content-Type" ] == "text/html; charset=utf-8"
101+ read_ = await r .read ()
102+ assert read_ == data
103103
104104
105105async def test_follow_symlink (
You can’t perform that action at this time.
0 commit comments