]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (#127358)
authorVictor Stinner <vstinner@python.org>
Fri, 29 Nov 2024 10:39:54 +0000 (11:39 +0100)
committerGitHub <noreply@github.com>
Fri, 29 Nov 2024 10:39:54 +0000 (11:39 +0100)
Replace the sleep(2) with a task which is blocked forever.

Lib/test/test_asyncio/test_eager_task_factory.py

index 31d2a00dbb8c9c7f3e07634fc7ffba8946923019..0e2b189f7615210aec89be4070aca7e4e8c545d5 100644 (file)
@@ -220,10 +220,14 @@ class EagerTaskFactoryLoopTests:
             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()
                 ],