MCPcopy Index your code
hub / github.com/python/cpython / test_ctrl_c

Method test_ctrl_c

Lib/test/test_asyncio/test_windows_events.py:57–74  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

55class ProactorLoopCtrlC(WindowsEventsTestCase):
56
57 def test_ctrl_c(self):
58
59 def SIGINT_after_delay():
60 time.sleep(0.1)
61 signal.raise_signal(signal.SIGINT)
62
63 thread = threading.Thread(target=SIGINT_after_delay)
64 loop = asyncio.new_event_loop()
65 try:
66 # only start the loop once the event loop is running
67 loop.call_soon(thread.start)
68 loop.run_forever()
69 self.fail("should not fall through 'run_forever'")
70 except KeyboardInterrupt:
71 pass
72 finally:
73 self.close_loop(loop)
74 thread.join()
75
76
77class ProactorMultithreading(WindowsEventsTestCase):

Callers

nothing calls this directly

Calls 6

joinMethod · 0.95
new_event_loopMethod · 0.45
call_soonMethod · 0.45
run_foreverMethod · 0.45
failMethod · 0.45
close_loopMethod · 0.45

Tested by

no test coverage detected