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.
()
| 238 | |
| 239 | |
| 240 | def 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 |
| 263 | def test_xmode_skip(): |
nothing calls this directly
no outgoing calls
no test coverage detected