MCPcopy Create free account
hub / github.com/microsoft/debugpy / test_add_and_remove_breakpoint

Function test_add_and_remove_breakpoint

tests/debugpy/test_breakpoints.py:250–281  ·  view source on GitHub ↗
(pyfile, target, run)

Source from the content-addressed store, hash-verified

248
249
250def test_add_and_remove_breakpoint(pyfile, target, run):
251 @pyfile
252 def code_to_debug():
253 import debuggee
254
255 debuggee.setup()
256 for i in range(0, 10):
257 print(i) # @bp
258 x = 4 # @wait_for_output
259
260 with debug.Session() as session:
261 session.config["redirectOutput"] = True
262
263 with run(session, target(code_to_debug)):
264 session.set_breakpoints(code_to_debug, all)
265
266 session.wait_for_stop(
267 "breakpoint", expected_frames=[some.dap.frame(code_to_debug, line="bp")]
268 )
269
270 # Remove breakpoint inside the loop.
271 session.set_breakpoints(code_to_debug, ["wait_for_output"])
272 session.request_continue()
273
274 session.wait_for_stop(
275 "breakpoint",
276 expected_frames=[some.dap.frame(code_to_debug, line="wait_for_output")],
277 )
278 session.request_continue()
279
280 expected_stdout = "".join(f"{i}\n" for i in range(0, 10))
281 assert session.output("stdout") == expected_stdout
282
283
284def test_breakpoint_in_nonexistent_file(pyfile, target, run):

Callers

nothing calls this directly

Calls 7

set_breakpointsMethod · 0.80
wait_for_stopMethod · 0.80
request_continueMethod · 0.80
outputMethod · 0.80
runFunction · 0.70
targetFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…