From 00ac40c38286e2b2badfceee9a70e0d547119ca9 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 28 Nov 2024 11:28:38 +0100 Subject: [PATCH] gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() Replace the sleep(2) with a task which is blocked forever. --- Lib/test/test_asyncio/test_eager_task_factory.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_asyncio/test_eager_task_factory.py b/Lib/test/test_asyncio/test_eager_task_factory.py index 31d2a00dbb8c9c..0e2b189f761521 100644 --- a/Lib/test/test_asyncio/test_eager_task_factory.py +++ b/Lib/test/test_asyncio/test_eager_task_factory.py @@ -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() ],