summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/async_case.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/unittest/async_case.py')
-rw-r--r--Lib/unittest/async_case.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/unittest/async_case.py b/Lib/unittest/async_case.py
index a90eed9..8b06fad 100644
--- a/Lib/unittest/async_case.py
+++ b/Lib/unittest/async_case.py
@@ -116,6 +116,10 @@ class IsolatedAsyncioTestCase(TestCase):
assert self._asyncioRunner is None, 'asyncio runner is already initialized'
runner = asyncio.Runner(debug=True)
self._asyncioRunner = runner
+ # Force loop to be initialized and set as the current loop
+ # so that setUp functions can use get_event_loop() and get the
+ # correct loop instance.
+ runner.get_loop()
def _tearDownAsyncioRunner(self):
runner = self._asyncioRunner