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

Function test_conditional_breakpoint

tests/debugpy/test_breakpoints.py:68–101  ·  view source on GitHub ↗
(pyfile, target, run, condition_kind, condition)

Source from the content-addressed store, hash-verified

66@pytest.mark.parametrize("condition_kind, condition", list(conditions.keys()))
67@pytest.mark.parametrize("target", targets.all_named)
68def test_conditional_breakpoint(pyfile, target, run, condition_kind, condition):
69 hit = conditions[condition_kind, condition]
70
71 @pyfile
72 def code_to_debug():
73 import debuggee
74
75 debuggee.setup()
76 for i in range(1, 10):
77 print(i) # @bp
78
79 with debug.Session() as session:
80 with run(session, target(code_to_debug)):
81 session.request(
82 "setBreakpoints",
83 {
84 "source": {"path": code_to_debug},
85 "breakpoints": [
86 {"line": code_to_debug.lines["bp"], condition_kind: condition}
87 ],
88 },
89 )
90
91 for i in range(1, 10):
92 if not hit(i):
93 continue
94 session.wait_for_stop(
95 expected_frames=[some.dap.frame(code_to_debug, line="bp")]
96 )
97 var_i = session.get_variable("i")
98 assert var_i == some.dict.containing(
99 {"name": "i", "evaluateName": "i", "type": "int", "value": str(i)}
100 )
101 session.request_continue()
102
103
104def test_crossfile_breakpoint(pyfile, target, run):

Callers

nothing calls this directly

Calls 6

wait_for_stopMethod · 0.80
request_continueMethod · 0.80
runFunction · 0.70
targetFunction · 0.70
requestMethod · 0.45
get_variableMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…