]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix `test_run_until_complete_baseexception` test to check for `KeyboardInterrupt...
authorFantix King <fantix.king@gmail.com>
Thu, 8 Dec 2022 08:21:04 +0000 (03:21 -0500)
committerGitHub <noreply@github.com>
Thu, 8 Dec 2022 08:21:04 +0000 (13:51 +0530)
Lib/test/test_asyncio/test_base_events.py

index 65dd4d42708b519ed260ca04aa302f5a0df5e2b1..532a7e5385aeb59da1e4fb6b4125bbb404b1bd5b 100644 (file)
@@ -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):