(start_flask, bp_target)
| 67 | |
| 68 | @pytest.mark.parametrize("bp_target", ["code", "template"]) |
| 69 | def test_flask_breakpoint_no_multiproc(start_flask, bp_target): |
| 70 | bp_file, bp_line, bp_name = { |
| 71 | "code": (paths.app_py, lines.app_py["bphome"], "home"), |
| 72 | "template": (paths.hello_html, 8, "template"), |
| 73 | }[bp_target] |
| 74 | bp_var_content = "Flask-Jinja-Test" |
| 75 | |
| 76 | with debug.Session() as session: |
| 77 | with start_flask(session): |
| 78 | breakpoints = session.set_breakpoints(bp_file, [bp_line]) |
| 79 | for bp in breakpoints: |
| 80 | # They'll be verified later on for templates. |
| 81 | assert bp["verified"] == (bp_target == "code") |
| 82 | |
| 83 | with flask_server: |
| 84 | home_request = flask_server.get("/") |
| 85 | |
| 86 | if bp_target == "template": |
| 87 | breakpoint_body = session.wait_for_next_event("breakpoint") |
| 88 | assert breakpoint_body["reason"] == "changed" |
| 89 | assert breakpoint_body["breakpoint"]["verified"] |
| 90 | |
| 91 | session.wait_for_stop( |
| 92 | "breakpoint", |
| 93 | expected_frames=[ |
| 94 | some.dap.frame(some.dap.source(bp_file), name=bp_name, line=bp_line) |
| 95 | ], |
| 96 | ) |
| 97 | |
| 98 | var_content = session.get_variable("content") |
| 99 | assert var_content == some.dict.containing( |
| 100 | { |
| 101 | "name": "content", |
| 102 | "type": "str", |
| 103 | "value": repr(bp_var_content), |
| 104 | "presentationHint": {"attributes": ["rawString"]}, |
| 105 | "evaluateName": "content", |
| 106 | "variablesReference": 0, |
| 107 | } |
| 108 | ) |
| 109 | |
| 110 | session.request_continue() |
| 111 | assert bp_var_content in home_request.response_text() |
| 112 | |
| 113 | |
| 114 | def test_flask_template_exception_no_multiproc(start_flask): |
nothing calls this directly
no test coverage detected
searching dependent graphs…