MCPcopy Create free account
hub / github.com/microsoft/debugpy / test_django_breakpoint_no_multiproc

Function test_django_breakpoint_no_multiproc

tests/debugpy/test_django.py:46–88  ·  view source on GitHub ↗
(start_django, bp_target)

Source from the content-addressed store, hash-verified

44
45@pytest.mark.parametrize("bp_target", ["code", "template"])
46def test_django_breakpoint_no_multiproc(start_django, bp_target):
47 bp_file, bp_line, bp_name = {
48 "code": (paths.app_py, lines.app_py["bphome"], "home"),
49 "template": (paths.hello_html, 8, "Django Template"),
50 }[bp_target]
51 bp_var_content = "Django-Django-Test"
52
53 with debug.Session() as session:
54 with start_django(session):
55 breakpoints = session.set_breakpoints(bp_file, [bp_line])
56 for bp in breakpoints:
57 # They'll be verified later on for templates.
58 assert bp["verified"] == (bp_target == "code")
59
60 with django_server:
61 home_request = django_server.get("/home")
62
63 if bp_target == "template":
64 breakpoint_body = session.wait_for_next_event("breakpoint")
65 assert breakpoint_body["reason"] == "changed"
66 assert breakpoint_body["breakpoint"]["verified"]
67
68 session.wait_for_stop(
69 "breakpoint",
70 expected_frames=[
71 some.dap.frame(some.dap.source(bp_file), line=bp_line, name=bp_name)
72 ],
73 )
74
75 var_content = session.get_variable("content")
76 assert var_content == some.dict.containing(
77 {
78 "name": "content",
79 "type": "str",
80 "value": repr(bp_var_content),
81 "presentationHint": {"attributes": ["rawString"]},
82 "evaluateName": "content",
83 "variablesReference": 0,
84 }
85 )
86
87 session.request_continue()
88 assert bp_var_content in home_request.response_text()
89
90
91def test_django_template_exception_no_multiproc(start_django):

Callers

nothing calls this directly

Calls 10

start_djangoFunction · 0.85
reprFunction · 0.85
set_breakpointsMethod · 0.80
wait_for_next_eventMethod · 0.80
wait_for_stopMethod · 0.80
request_continueMethod · 0.80
response_textMethod · 0.80
getMethod · 0.45
sourceMethod · 0.45
get_variableMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…