Skip to content

Commit fc6c2de

Browse files
[3.12] gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358) (#127402)
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 <[email protected]>
1 parent 91399c3 commit fc6c2de

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
@@ -225,10 +225,14 @@ async def fail():
225225
await asyncio.sleep(0)
226226
raise ValueError("no good")
227227

228+
async def blocked():
229+
fut = asyncio.Future()
230+
await fut
231+
228232
async def run():
229233
winner, index, excs = await asyncio.staggered.staggered_race(
230234
[
231-
lambda: asyncio.sleep(2, result="sleep2"),
235+
lambda: blocked(),
232236
lambda: asyncio.sleep(1, result="sleep1"),
233237
lambda: fail()
234238
],

0 commit comments

Comments
 (0)