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

Function test_stack_format

tests/debugpy/test_vs_specific.py:14–48  ·  view source on GitHub ↗
(pyfile, target, run, module, line)

Source from the content-addressed store, hash-verified

12@pytest.mark.parametrize("module", ["module", ""])
13@pytest.mark.parametrize("line", ["line", ""])
14def test_stack_format(pyfile, target, run, module, line):
15 @pyfile
16 def code_to_debug():
17 import debuggee
18 from test_module import do_something
19
20 debuggee.setup()
21 do_something()
22
23 @pyfile
24 def test_module():
25 def do_something():
26 print("break here") # @bp
27
28 with debug.Session() as session:
29 with run(session, target(code_to_debug)):
30 session.set_breakpoints(test_module, all)
31
32 stop = session.wait_for_stop(
33 "breakpoint", expected_frames=[some.dap.frame(test_module, line="bp")]
34 )
35 stack_trace = session.request(
36 "stackTrace",
37 {
38 "threadId": stop.thread_id,
39 "format": {"module": bool(module), "line": bool(line)},
40 },
41 )
42 assert stack_trace["totalFrames"] > 0
43 name = stack_trace["stackFrames"][0]["name"]
44 if line:
45 assert (": " + str(test_module.lines["bp"])) in name
46 if module:
47 assert "test_module" in name
48 session.request_continue()
49
50
51def test_module_events(pyfile, target, run):

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…