(start_django, bp_target)
| 44 | |
| 45 | @pytest.mark.parametrize("bp_target", ["code", "template"]) |
| 46 | def 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 | |
| 91 | def test_django_template_exception_no_multiproc(start_django): |
nothing calls this directly
no test coverage detected
searching dependent graphs…