diff options
author | Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> | 2022-08-16 15:52:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-16 15:52:06 (GMT) |
commit | 9d515997f943b7b510268448f372dabcbf957858 (patch) | |
tree | 8380d58fa0069ec48a38d6d99057db6168a98b12 /Lib/unittest | |
parent | 5a8c15819c27c516e5b75b7c9d89eacdb16b77c3 (diff) | |
download | cpython-9d515997f943b7b510268448f372dabcbf957858.zip cpython-9d515997f943b7b510268448f372dabcbf957858.tar.gz cpython-9d515997f943b7b510268448f372dabcbf957858.tar.bz2 |
GH-95736: fix IsolatedAsyncioTestCase to initialize Runner before calling setup functions (#95898)
Diffstat (limited to 'Lib/unittest')
-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..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 |