Skip to content

Commit 57d6fda

Browse files
committed
fix cluster test to run within delay context
1 parent cf07d75 commit 57d6fda

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

tests/test_asyncio/test_cwe_404.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,18 @@ def set_delay(delay: int = 0):
219219
await r.set("foo", "foo")
220220
await r.set("bar", "bar")
221221

222+
async def op(r):
223+
with set_delay(delay=delay):
224+
return await r.get("foo")
225+
222226
all_clear()
223-
with set_delay(delay=delay):
224-
t = asyncio.create_task(r.get("foo"))
225-
# One of the proxies will handle our request, wait for it to send
226-
await any_wait()
227-
await asyncio.sleep(delay)
228-
t.cancel()
229-
with pytest.raises(asyncio.CancelledError):
230-
await t
227+
t = asyncio.create_task(op(r))
228+
# One of the proxies will handle our request, wait for it to send
229+
await any_wait()
230+
await asyncio.sleep(delay)
231+
t.cancel()
232+
with pytest.raises(asyncio.CancelledError):
233+
await t
231234

232235
# try a number of requests to excercise all the connections
233236
async def doit():

0 commit comments

Comments
 (0)