bpo-45011: Fix test_asyncio without C module _asyncio (GH-27968)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Serhiy Storchaka 2021-08-26 15:48:24 +03:00 committed by GitHub
parent 8868d48712
commit 7dc505b865
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 7 deletions

View file

@ -29,10 +29,6 @@ class FunctionalTestCaseMixin:
self.loop.set_exception_handler(self.loop_exception_handler)
self.__unhandled_exceptions = []
# Disable `_get_running_loop`.
self._old_get_running_loop = asyncio.events._get_running_loop
asyncio.events._get_running_loop = lambda: None
def tearDown(self):
try:
self.loop.close()
@ -43,7 +39,6 @@ class FunctionalTestCaseMixin:
self.fail('unexpected calls to loop.call_exception_handler()')
finally:
asyncio.events._get_running_loop = self._old_get_running_loop
asyncio.set_event_loop(None)
self.loop = None