Skip to content

GH-109067: fix randomly failing test_async_gen_asyncio_gc_aclose_09 test #109142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Lib/test/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,7 @@ async def gen():
while True:
yield 1
finally:
await asyncio.sleep(0.01)
await asyncio.sleep(0.01)
await asyncio.sleep(0)
DONE = 1

async def run():
Expand All @@ -1069,7 +1068,10 @@ async def run():
del g
gc_collect() # For PyPy or other GCs.

await asyncio.sleep(0.1)
# Starts running the aclose task
await asyncio.sleep(0)
# For asyncio.sleep(0) in finally block
await asyncio.sleep(0)

self.loop.run_until_complete(run())
self.assertEqual(DONE, 1)
Expand Down