MCPcopy Create free account
hub / github.com/ipython/ipython / test_interruptible_core_debugger

Function test_interruptible_core_debugger

IPython/core/tests/test_debugger.py:240–260  ·  view source on GitHub ↗

The debugger can be interrupted. The presumption is there is some mechanism that causes a KeyboardInterrupt (this is implemented in ipykernel). We want to ensure the KeyboardInterrupt cause debugging to cease.

()

Source from the content-addressed store, hash-verified

238
239
240def test_interruptible_core_debugger():
241 """The debugger can be interrupted.
242
243 The presumption is there is some mechanism that causes a KeyboardInterrupt
244 (this is implemented in ipykernel). We want to ensure the
245 KeyboardInterrupt cause debugging to cease.
246 """
247 def raising_input(msg="", called=[0]):
248 called[0] += 1
249 if called[0] == 1:
250 raise KeyboardInterrupt()
251 else:
252 raise AssertionError("input() should only be called once!")
253
254 with patch.object(builtins, "input", raising_input):
255 debugger.InterruptiblePdb().set_trace()
256 # The way this test will fail is by set_trace() never exiting,
257 # resulting in a timeout by the test runner. The alternative
258 # implementation would involve a subprocess, but that adds issues with
259 # interrupting subprocesses that are rather complex, so it's simpler
260 # just to do it this way.
261
262@skip_win32
263def test_xmode_skip():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected