##// END OF EJS Templates
TST: Restore original trace function
Nikita Kniazev -
Show More
@@ -247,13 +247,19 b' def test_interruptible_core_debugger():'
247 247 else:
248 248 raise AssertionError("input() should only be called once!")
249 249
250 with patch.object(builtins, "input", raising_input):
251 debugger.InterruptiblePdb().set_trace()
252 # The way this test will fail is by set_trace() never exiting,
253 # resulting in a timeout by the test runner. The alternative
254 # implementation would involve a subprocess, but that adds issues with
255 # interrupting subprocesses that are rather complex, so it's simpler
256 # just to do it this way.
250 tracer_orig = sys.gettrace()
251 try:
252 with patch.object(builtins, "input", raising_input):
253 debugger.InterruptiblePdb().set_trace()
254 # The way this test will fail is by set_trace() never exiting,
255 # resulting in a timeout by the test runner. The alternative
256 # implementation would involve a subprocess, but that adds issues
257 # with interrupting subprocesses that are rather complex, so it's
258 # simpler just to do it this way.
259 finally:
260 # restore the original trace function
261 sys.settrace(tracer_orig)
262
257 263
258 264 @skip_win32
259 265 def test_xmode_skip():
General Comments 0
You need to be logged in to leave comments. Login now