Skip to content

Commit

Permalink
Fix test_run_until_complete_baseexception test to check for `Keyboa…
Browse files Browse the repository at this point in the history
…rdInterrupt` in asyncio (#24477)
  • Loading branch information
fantix committed Dec 8, 2022
1 parent ded02ca commit e8fff51
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Lib/test/test_asyncio/test_base_events.py
Expand Up @@ -861,20 +861,15 @@ async def raise_keyboard_interrupt():

self.loop._process_events = mock.Mock()

try:
with self.assertRaises(KeyboardInterrupt):
self.loop.run_until_complete(raise_keyboard_interrupt())
except KeyboardInterrupt:
pass

def func():
self.loop.stop()
func.called = True
func.called = False
try:
self.loop.call_soon(func)
self.loop.run_forever()
except KeyboardInterrupt:
pass
self.loop.call_later(0.01, func)
self.loop.run_forever()
self.assertTrue(func.called)

def test_single_selecter_event_callback_after_stopping(self):
Expand Down

0 comments on commit e8fff51

Please sign in to comment.