Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2e3e653

Browse filesBrowse files
improve test_tasks to use correct idiom for starting task in asyncio (#130257)
The test should use the correct idiom for starting the task, `loop._run_once` is private API which should not be used directly, instead use `asyncio.sleep(0)` for 1 event loop cycle.
1 parent b93b7e5 commit 2e3e653
Copy full SHA for 2e3e653

File tree

1 file changed

+1
-3
lines changed
Filter options

1 file changed

+1
-3
lines changed

‎Lib/test/test_asyncio/test_tasks.py

Copy file name to clipboardExpand all lines: Lib/test/test_asyncio/test_tasks.py
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,10 +2272,8 @@ async def kill_me(loop):
22722272

22732273
self.assertEqual(self.all_tasks(loop=self.loop), {task})
22742274

2275-
asyncio._set_event_loop(None)
2276-
22772275
# execute the task so it waits for future
2278-
self.loop._run_once()
2276+
self.loop.run_until_complete(asyncio.sleep(0))
22792277
self.assertEqual(len(self.loop._ready), 0)
22802278

22812279
coro = None

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.