mirror of https://github.com/python/cpython
Issue #24017: Unset asyncio event loop after test.
This commit is contained in:
parent
08a7a4e592
commit
fdba8381ff
|
@ -772,13 +772,15 @@ class CoroAsyncIOCompatTest(unittest.TestCase):
|
|||
raise MyException
|
||||
buffer.append('unreachable')
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
try:
|
||||
loop.run_until_complete(f())
|
||||
except MyException:
|
||||
pass
|
||||
finally:
|
||||
loop.close()
|
||||
asyncio.set_event_loop(None)
|
||||
|
||||
self.assertEqual(buffer, [1, 2, 'MyException'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue