Issue #24017: Unset asyncio event loop after test.

This commit is contained in:
Yury Selivanov 2015-05-12 14:28:08 -04:00
parent 08a7a4e592
commit fdba8381ff
1 changed files with 3 additions and 1 deletions

View File

@ -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'])