Skip to content

Commit fdba838

Browse files
committed
Issue python#24017: Unset asyncio event loop after test.
1 parent 08a7a4e commit fdba838

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/test/test_coroutines.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,13 +772,15 @@ async def f():
772772
raise MyException
773773
buffer.append('unreachable')
774774

775-
loop = asyncio.get_event_loop()
775+
loop = asyncio.new_event_loop()
776+
asyncio.set_event_loop(loop)
776777
try:
777778
loop.run_until_complete(f())
778779
except MyException:
779780
pass
780781
finally:
781782
loop.close()
783+
asyncio.set_event_loop(None)
782784

783785
self.assertEqual(buffer, [1, 2, 'MyException'])
784786

0 commit comments

Comments
 (0)