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

Function test_django_exception_no_multiproc

tests/debugpy/test_django.py:137–184  ·  view source on GitHub ↗
(start_django, exc_type)

Source from the content-addressed store, hash-verified

135
136@pytest.mark.parametrize("exc_type", ["handled", "unhandled"])
137def test_django_exception_no_multiproc(start_django, exc_type):
138 exc_line = lines.app_py["exc_" + exc_type]
139
140 with debug.Session() as session:
141 with start_django(session):
142 session.request(
143 "setExceptionBreakpoints", {"filters": ["raised", "uncaught"]}
144 )
145
146 with django_server:
147 django_server.get("/" + exc_type)
148
149 stopped = session.wait_for_stop(
150 "exception",
151 expected_frames=[
152 some.dap.frame(
153 some.dap.source(paths.app_py),
154 line=exc_line,
155 name="bad_route_" + exc_type,
156 )
157 ],
158 ).body
159
160 assert stopped == some.dict.containing(
161 {
162 "reason": "exception",
163 "text": some.str.ending_with("ArithmeticError"),
164 "description": "Hello",
165 }
166 )
167
168 exception_info = session.request(
169 "exceptionInfo", {"threadId": stopped["threadId"]}
170 )
171
172 assert exception_info == {
173 "exceptionId": some.str.ending_with("ArithmeticError"),
174 "breakMode": "always",
175 "description": "Hello",
176 "details": {
177 "message": "Hello",
178 "typeName": some.str.ending_with("ArithmeticError"),
179 "source": some.path(paths.app_py),
180 "stackTrace": some.str,
181 },
182 }
183
184 session.request_continue()
185
186
187def test_django_breakpoint_multiproc(start_django):

Callers

nothing calls this directly

Calls 7

start_djangoFunction · 0.85
wait_for_stopMethod · 0.80
pathMethod · 0.80
request_continueMethod · 0.80
requestMethod · 0.45
getMethod · 0.45
sourceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…