summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFantix King <fantix.king@gmail.com>2022-12-08 08:21:04 (GMT)
committerGitHub <noreply@github.com>2022-12-08 08:21:04 (GMT)
commite8fff515f056737d6d055ea5438b2135863548b1 (patch)
tree3f8764b556d8482048cf205ec8d118e87b6b71f7 /Lib
parentded02ca54d7bfa32c8eab0871d56e4547cd356eb (diff)
downloadcpython-e8fff515f056737d6d055ea5438b2135863548b1.zip
cpython-e8fff515f056737d6d055ea5438b2135863548b1.tar.gz
cpython-e8fff515f056737d6d055ea5438b2135863548b1.tar.bz2
Fix `test_run_until_complete_baseexception` test to check for `KeyboardInterrupt` in asyncio (#24477)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_asyncio/test_base_events.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index 65dd4d4..532a7e5 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -861,20 +861,15 @@ class BaseEventLoopTests(test_utils.TestCase):
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):