MCPcopy Index your code
hub / github.com/fabioz/PyDev.Debugger / test_case_json_logpoints

Function test_case_json_logpoints

tests_python/test_debugger_json.py:588–627  ·  view source on GitHub ↗
(case_setup_dap, scenario)

Source from the content-addressed store, hash-verified

586
587@pytest.mark.parametrize("scenario", ["basic", "condition", "hitCondition"])
588def test_case_json_logpoints(case_setup_dap, scenario):
589 with case_setup_dap.test_file("_debugger_case_change_breaks.py") as writer:
590 json_facade = JsonFacade(writer)
591
592 json_facade.write_launch()
593 break_2 = writer.get_line_index_with_content("break 2")
594 break_3 = writer.get_line_index_with_content("break 3")
595 if scenario == "basic":
596 json_facade.write_set_breakpoints([break_2, break_3], line_to_info={break_2: {"log_message": 'var {repr("_a")} is {_a}'}})
597 elif scenario == "condition":
598 json_facade.write_set_breakpoints(
599 [break_2, break_3], line_to_info={break_2: {"log_message": 'var {repr("_a")} is {_a}', "condition": "True"}}
600 )
601 elif scenario == "hitCondition":
602 json_facade.write_set_breakpoints(
603 [break_2, break_3], line_to_info={break_2: {"log_message": 'var {repr("_a")} is {_a}', "hit_condition": "1"}}
604 )
605 json_facade.write_make_initial_run()
606
607 # Should only print, not stop on logpoints.
608
609 # Just one hit at the end (break 3).
610 json_facade.wait_for_thread_stopped(line=break_3)
611 json_facade.write_continue()
612
613 def accept_message(output_event):
614 msg = output_event.body.output
615 ctx = output_event.body.category
616
617 if ctx == "stdout":
618 msg = msg.strip()
619 return msg == "var '_a' is 2"
620
621 messages = json_facade.mark_messages(OutputEvent, accept_message)
622 if scenario == "hitCondition":
623 assert len(messages) == 1
624 else:
625 assert len(messages) == 2
626
627 writer.finished_ok = True
628
629
630def test_case_json_logpoint_and_step_failure_ok(case_setup_dap):

Callers

nothing calls this directly

Calls 9

write_launchMethod · 0.95
write_set_breakpointsMethod · 0.95
write_continueMethod · 0.95
mark_messagesMethod · 0.95
JsonFacadeClass · 0.85
test_fileMethod · 0.80

Tested by

no test coverage detected