(case_setup, tmpdir)
| 2397 | |
| 2398 | @pytest.mark.skipif(not IS_CPYTHON, reason="CPython only test.") |
| 2399 | def test_linecache_xml(case_setup, tmpdir): |
| 2400 | from _pydevd_bundle.pydevd_comm_constants import CMD_LOAD_SOURCE_FROM_FRAME_ID |
| 2401 | |
| 2402 | with case_setup.test_file("_debugger_case_linecache.py") as writer: |
| 2403 | writer.write_add_breakpoint(writer.get_line_index_with_content("breakpoint")) |
| 2404 | writer.write_make_initial_run() |
| 2405 | |
| 2406 | # First hit is for breakpoint reached via a stack frame that doesn't have source. |
| 2407 | hit = writer.wait_for_breakpoint_hit() |
| 2408 | |
| 2409 | writer.write_get_thread_stack(hit.thread_id) |
| 2410 | msg = writer.wait_for_get_thread_stack_message() |
| 2411 | frame_ids = set() |
| 2412 | for frame in msg.thread.frame: |
| 2413 | if frame["file"] == "<foo bar>": |
| 2414 | frame_ids.add(frame["id"]) |
| 2415 | |
| 2416 | assert len(frame_ids) == 2 |
| 2417 | |
| 2418 | for frame_id in frame_ids: |
| 2419 | writer.write_load_source_from_frame_id(frame_id) |
| 2420 | writer.wait_for_message( |
| 2421 | lambda msg: "%s\t" % CMD_LOAD_SOURCE_FROM_FRAME_ID in msg |
| 2422 | and ("[x for x in range(10)]" in msg and "def somemethod():" in msg), |
| 2423 | expect_xml=False, |
| 2424 | ) |
| 2425 | |
| 2426 | writer.write_run_thread(hit.thread_id) |
| 2427 | |
| 2428 | writer.finished_ok = True |
| 2429 | |
| 2430 | |
| 2431 | @pytest.mark.skipif(not IS_CPYTHON, reason="CPython only test.") |
nothing calls this directly
no test coverage detected