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 @@ -219,9 +219,11 @@ async def test_no_handler_cancellation(aiohttp_unused_port) -> None:
219
219
timeout_event = asyncio .Event ()
220
220
done_event = asyncio .Event ()
221
221
port = aiohttp_unused_port ()
222
+ started = False
222
223
223
224
async def on_request (_ : web .Request ) -> web .Response :
224
- nonlocal done_event , timeout_event
225
+ nonlocal done_event , started , timeout_event
226
+ started = True
225
227
await asyncio .wait_for (timeout_event .wait (), timeout = 5 )
226
228
done_event .set ()
227
229
return web .Response ()
@@ -238,7 +240,7 @@ async def on_request(_: web.Request) -> web.Response:
238
240
239
241
try :
240
242
async with client .ClientSession (
241
- timeout = client .ClientTimeout (total = 0.1 )
243
+ timeout = client .ClientTimeout (total = 0.2 )
242
244
) as sess :
243
245
with pytest .raises (asyncio .TimeoutError ):
244
246
await sess .get (f"http://localhost:{ port } /" )
@@ -247,6 +249,7 @@ async def on_request(_: web.Request) -> web.Response:
247
249
248
250
with suppress (asyncio .TimeoutError ):
249
251
await asyncio .wait_for (done_event .wait (), timeout = 1 )
252
+ assert started
250
253
assert done_event .is_set ()
251
254
finally :
252
255
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(
93
93
client = await aiohttp_client (app )
94
94
95
95
# 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
98
98
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
103
103
104
104
105
105
async def test_follow_symlink (
You can’t perform that action at this time.
0 commit comments