Skip to content

Commit

Permalink
set the global event loop in _setupAsyncioRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Jun 16, 2022
1 parent 590c8d9 commit 19d8c96
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions aiohttp/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,15 @@ class AioHTTPTestCase(TestCase):
Note that the TestClient's methods are asynchronous: you have to
execute function on the test client using asynchronous methods.
"""
def _setupAsyncioRunner(self):
super()._setupAsyncioRunner()
asyncio.set_event_loop(self._asyncioRunner.get_loop())

def _tearDownAsyncioRunner(self):
try:
super()._tearDownAsyncioRunner()
finally:
asyncio.set_event_loop(None)

async def get_application(self) -> Application:
"""Get application.
Expand Down

0 comments on commit 19d8c96

Please sign in to comment.