Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -3257,6 +3256,7 @@ def __gt__(self, other):

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.
Expand Down
12 changes: 11 additions & 1 deletion Lib/unittest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def testMultiply(self):
__unittest = True

from .result import TestResult
from .async_case import IsolatedAsyncioTestCase
from .case import (addModuleCleanup, TestCase, FunctionTestCase, SkipTest, skip,
skipIf, skipUnless, expectedFailure)
from .suite import BaseTestSuite, TestSuite
Expand All @@ -78,3 +77,14 @@ def load_tests(loader, tests, pattern):
# top level directory cached on loader instance
this_dir = os.path.dirname(__file__)
return loader.discover(start_dir=this_dir, pattern=pattern)


def __dir__():
return globals().keys() | {'IsolatedAsyncioTestCase'}

def __getattr__(name):
if name == 'IsolatedAsyncioTestCase':
global IsolatedAsyncioTestCase
from .async_case import IsolatedAsyncioTestCase
return IsolatedAsyncioTestCase
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")