mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #24017: Unset asyncio event loop after test.
This commit is contained in:
parent
08a7a4e592
commit
fdba8381ff
1 changed files with 3 additions and 1 deletions
|
@ -772,13 +772,15 @@ class CoroAsyncIOCompatTest(unittest.TestCase):
|
||||||
raise MyException
|
raise MyException
|
||||||
buffer.append('unreachable')
|
buffer.append('unreachable')
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
try:
|
try:
|
||||||
loop.run_until_complete(f())
|
loop.run_until_complete(f())
|
||||||
except MyException:
|
except MyException:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
loop.close()
|
loop.close()
|
||||||
|
asyncio.set_event_loop(None)
|
||||||
|
|
||||||
self.assertEqual(buffer, [1, 2, 'MyException'])
|
self.assertEqual(buffer, [1, 2, 'MyException'])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue