(pyfile, target, run)
| 248 | |
| 249 | |
| 250 | def 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 | |
| 284 | def test_breakpoint_in_nonexistent_file(pyfile, target, run): |
nothing calls this directly
no test coverage detected
searching dependent graphs…