We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 894ebd0 commit d1e3403Copy full SHA for d1e3403
Lib/test/test_asyncio/test_base_events.py
@@ -529,6 +529,22 @@ def test_run_until_complete_loop(self):
529
self.assertRaises(ValueError,
530
other_loop.run_until_complete, task)
531
532
+ def test_run_until_complete_loop_orphan_future_close_loop(self):
533
+ async def foo(sec=0):
534
+ await asyncio.sleep(sec)
535
+
536
+ self.loop.close()
537
+ loop = asyncio.new_event_loop()
538
+ asyncio.set_event_loop(loop)
539
+ try:
540
+ with mock.patch('asyncio.base_events.BaseEventLoop.run_forever',
541
+ side_effect=Exception):
542
+ loop.run_until_complete(foo())
543
+ except:
544
+ pass
545
+ loop.run_until_complete(foo(0.1))
546
+ loop.close()
547
548
def test_subprocess_exec_invalid_args(self):
549
args = [sys.executable, '-c', 'pass']
550
0 commit comments