mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (#127358)
Replace the sleep(2) with a task which is blocked forever.
This commit is contained in:
parent
99490913a0
commit
bfabf96b50
1 changed files with 5 additions and 1 deletions
|
|
@ -220,10 +220,14 @@ class EagerTaskFactoryLoopTests:
|
||||||
await asyncio.sleep(0)
|
await asyncio.sleep(0)
|
||||||
raise ValueError("no good")
|
raise ValueError("no good")
|
||||||
|
|
||||||
|
async def blocked():
|
||||||
|
fut = asyncio.Future()
|
||||||
|
await fut
|
||||||
|
|
||||||
async def run():
|
async def run():
|
||||||
winner, index, excs = await asyncio.staggered.staggered_race(
|
winner, index, excs = await asyncio.staggered.staggered_race(
|
||||||
[
|
[
|
||||||
lambda: asyncio.sleep(2, result="sleep2"),
|
lambda: blocked(),
|
||||||
lambda: asyncio.sleep(1, result="sleep1"),
|
lambda: asyncio.sleep(1, result="sleep1"),
|
||||||
lambda: fail()
|
lambda: fail()
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue