mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Merge 3.5 (issue #28613)
This commit is contained in:
commit
1994dd360b
2 changed files with 5 additions and 0 deletions
|
@ -6,6 +6,7 @@ __all__ = ['AbstractEventLoopPolicy',
|
||||||
'get_event_loop_policy', 'set_event_loop_policy',
|
'get_event_loop_policy', 'set_event_loop_policy',
|
||||||
'get_event_loop', 'set_event_loop', 'new_event_loop',
|
'get_event_loop', 'set_event_loop', 'new_event_loop',
|
||||||
'get_child_watcher', 'set_child_watcher',
|
'get_child_watcher', 'set_child_watcher',
|
||||||
|
'_set_running_loop', '_get_running_loop',
|
||||||
]
|
]
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
|
|
|
@ -2732,9 +2732,11 @@ class PolicyTests(unittest.TestCase):
|
||||||
try:
|
try:
|
||||||
asyncio.set_event_loop_policy(Policy())
|
asyncio.set_event_loop_policy(Policy())
|
||||||
loop = asyncio.new_event_loop()
|
loop = asyncio.new_event_loop()
|
||||||
|
self.assertIs(asyncio._get_running_loop(), None)
|
||||||
|
|
||||||
async def func():
|
async def func():
|
||||||
self.assertIs(asyncio.get_event_loop(), loop)
|
self.assertIs(asyncio.get_event_loop(), loop)
|
||||||
|
self.assertIs(asyncio._get_running_loop(), loop)
|
||||||
|
|
||||||
loop.run_until_complete(func())
|
loop.run_until_complete(func())
|
||||||
finally:
|
finally:
|
||||||
|
@ -2742,6 +2744,8 @@ class PolicyTests(unittest.TestCase):
|
||||||
if loop is not None:
|
if loop is not None:
|
||||||
loop.close()
|
loop.close()
|
||||||
|
|
||||||
|
self.assertIs(asyncio._get_running_loop(), None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue