mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-40275: Avoid importing asyncio in test.support (GH-19600)
* Import asyncio lazily in unittest (only when IsolatedAsyncioTestCase is used). * Import asyncio.events lazily in test.support.
This commit is contained in:
parent
d4f3923d59
commit
3c8a5b459d
3 changed files with 19 additions and 2 deletions
|
@ -3,7 +3,6 @@
|
|||
if __name__ != 'test.support':
|
||||
raise ImportError('support must be imported from the test package')
|
||||
|
||||
import asyncio.events
|
||||
import collections.abc
|
||||
import contextlib
|
||||
import errno
|
||||
|
@ -3260,6 +3259,7 @@ SMALLEST = _SMALLEST()
|
|||
|
||||
def maybe_get_event_loop_policy():
|
||||
"""Return the global event loop policy if one is set, else return None."""
|
||||
import asyncio.events
|
||||
return asyncio.events._event_loop_policy
|
||||
|
||||
# Helpers for testing hashing.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue