(pyfile, target, run, module, line)
| 12 | @pytest.mark.parametrize("module", ["module", ""]) |
| 13 | @pytest.mark.parametrize("line", ["line", ""]) |
| 14 | def 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 | |
| 51 | def test_module_events(pyfile, target, run): |
nothing calls this directly
no test coverage detected
searching dependent graphs…