Skip to content

Commit

Permalink
gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (#127358)
Browse files Browse the repository at this point in the history
Replace the sleep(2) with a task which is blocked forever.
  • Loading branch information
vstinner authored Nov 29, 2024
1 parent 9949091 commit bfabf96
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Lib/test/test_asyncio/test_eager_task_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,14 @@ async def fail():
await asyncio.sleep(0)
raise ValueError("no good")

async def blocked():
fut = asyncio.Future()
await fut

async def run():
winner, index, excs = await asyncio.staggered.staggered_race(
[
lambda: asyncio.sleep(2, result="sleep2"),
lambda: blocked(),
lambda: asyncio.sleep(1, result="sleep1"),
lambda: fail()
],
Expand Down

0 comments on commit bfabf96

Please sign in to comment.