File tree 2 files changed +11
-8
lines changed
2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -254,9 +254,11 @@ async def test_no_handler_cancellation(aiohttp_unused_port) -> None:
254
254
timeout_event = asyncio .Event ()
255
255
done_event = asyncio .Event ()
256
256
port = aiohttp_unused_port ()
257
+ started = False
257
258
258
259
async def on_request (_ : web .Request ) -> web .Response :
259
- nonlocal done_event , timeout_event
260
+ nonlocal done_event , started , timeout_event
261
+ started = True
260
262
await asyncio .wait_for (timeout_event .wait (), timeout = 5 )
261
263
done_event .set ()
262
264
return web .Response ()
@@ -273,7 +275,7 @@ async def on_request(_: web.Request) -> web.Response:
273
275
274
276
try :
275
277
async with client .ClientSession (
276
- timeout = client .ClientTimeout (total = 0.1 )
278
+ timeout = client .ClientTimeout (total = 0.2 )
277
279
) as sess :
278
280
with pytest .raises (asyncio .TimeoutError ):
279
281
await sess .get (f"http://localhost:{ port } /" )
@@ -282,6 +284,7 @@ async def on_request(_: web.Request) -> web.Response:
282
284
283
285
with suppress (asyncio .TimeoutError ):
284
286
await asyncio .wait_for (done_event .wait (), timeout = 1 )
287
+ assert started
285
288
assert done_event .is_set ()
286
289
finally :
287
290
await asyncio .gather (runner .shutdown (), site .stop ())
Original file line number Diff line number Diff line change @@ -71,13 +71,13 @@ async def test_access_root_of_static_handler(
71
71
client = await aiohttp_client (app )
72
72
73
73
# Request the root of the static directory.
74
- r = await client .get (prefix )
75
- assert r .status == status
74
+ async with await client .get (prefix ) as r :
75
+ assert r .status == status
76
76
77
- if data :
78
- assert r .headers ["Content-Type" ] == "text/html; charset=utf-8"
79
- read_ = await r .read ()
80
- assert read_ == data
77
+ if data :
78
+ assert r .headers ["Content-Type" ] == "text/html; charset=utf-8"
79
+ read_ = await r .read ()
80
+ assert read_ == data
81
81
82
82
83
83
async def test_follow_symlink (
You can’t perform that action at this time.
0 commit comments