diff options
Diffstat (limited to 'Lib/unittest/async_case.py')
-rw-r--r-- | Lib/unittest/async_case.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/unittest/async_case.py b/Lib/unittest/async_case.py index a90eed9..3457e92 100644 --- a/Lib/unittest/async_case.py +++ b/Lib/unittest/async_case.py @@ -79,6 +79,10 @@ class IsolatedAsyncioTestCase(TestCase): return result def _callSetUp(self): + # 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. + self._asyncioRunner.get_loop() self._asyncioTestContext.run(self.setUp) self._callAsync(self.asyncSetUp) |