8000 [3.13] gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() … · python/cpython@1056f38 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1056f38

Browse files
[3.13] gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358) (#127401)
gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358) Replace the sleep(2) with a task which is blocked forever. (cherry picked from commit bfabf96) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 92d14b7 commit 1056f38

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Lib/test/test_asyncio/test_eager_task_factory.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,14 @@ async def fail():
220220
await asyncio.sleep(0)
221221
raise ValueError("no good")
222222

223+
async def blocked():
224+
fut = asyncio.Future()
225+
await fut
226+
223227
async def run():
224228
winner, index, excs = await asyncio.staggered.staggered_race(
225229
[
226-
lambda: asyncio.sleep(2, result="sleep2"),
230+
lambda: blocked(),
227231
lambda: asyncio.sleep(1, result="sleep1"),
228232
lambda: fail()
229233
],

0 commit comments

Comments
 (0)
0