MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / test_debug_options

Function test_debug_options

tests_python/test_debugger_json.py:5785–5836  ·  view source on GitHub ↗
(case_setup_dap, val)

Source from the content-addressed store, hash-verified

5783
5784@pytest.mark.parametrize("val", [True, False])
5785def test_debug_options(case_setup_dap, val):
5786 with case_setup_dap.test_file("_debugger_case_debug_options.py") as writer:
5787 json_facade = JsonFacade(writer)
5788 gui_event_loop = "matplotlib"
5789 if val:
5790 try:
5791 import PySide2.QtCore
5792 except ImportError:
5793 pass
5794 else:
5795 gui_event_loop = "pyside2"
5796 args = dict(
5797 justMyCode=val,
5798 redirectOutput=True, # Always redirect the output regardless of other values.
5799 showReturnValue=val,
5800 breakOnSystemExitZero=val,
5801 django=val,
5802 flask=val,
5803 stopOnEntry=val,
5804 maxExceptionStackFrames=4 if val else 5,
5805 guiEventLoop=gui_event_loop,
5806 clientOS="UNIX" if val else "WINDOWS",
5807 )
5808 json_facade.write_launch(**args)
5809
5810 json_facade.write_make_initial_run()
5811 if args["stopOnEntry"]:
5812 json_facade.wait_for_thread_stopped("entry")
5813 json_facade.write_continue()
5814
5815 output = json_facade.wait_for_json_message(
5816 OutputEvent, lambda msg: msg.body.category == "stdout" and msg.body.output.startswith("{") and msg.body.output.endswith("}")
5817 )
5818
5819 # The values printed are internal values from _pydevd_bundle.pydevd_json_debug_options.DebugOptions,
5820 # not the parameters we passed.
5821 translation = {
5822 "django": "django_debug",
5823 "flask": "flask_debug",
5824 "justMyCode": "just_my_code",
5825 "redirectOutput": "redirect_output",
5826 "showReturnValue": "show_return_value",
5827 "breakOnSystemExitZero": "break_system_exit_zero",
5828 "stopOnEntry": "stop_on_entry",
5829 "maxExceptionStackFrames": "max_exception_stack_frames",
5830 "guiEventLoop": "gui_event_loop",
5831 "clientOS": "client_os",
5832 }
5833
5834 assert json.loads(output.body.output) == dict((translation[key], val) for key, val in args.items())
5835 json_facade.wait_for_terminated()
5836 writer.finished_ok = True
5837
5838
5839def test_gui_event_loop_custom(case_setup_dap):

Callers

nothing calls this directly

Calls 10

write_launchMethod · 0.95
write_continueMethod · 0.95
wait_for_json_messageMethod · 0.95
wait_for_terminatedMethod · 0.95
JsonFacadeClass · 0.85
test_fileMethod · 0.80
loadsMethod · 0.80
itemsMethod · 0.80

Tested by

no test coverage detected