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

Function start_flask

tests/debugpy/test_flask.py:30–65  ·  view source on GitHub ↗
(run)

Source from the content-addressed store, hash-verified

28
29@pytest.fixture
30def start_flask(run):
31 def start(session, multiprocess=False):
32 # No clean way to kill Flask server, expect non-zero exit code
33 session.expected_exit_code = some.int
34
35 session.config.env.update(
36 {
37 "FLASK_APP": paths.app_py,
38 "FLASK_ENV": "development",
39 "FLASK_DEBUG": "1" if multiprocess else "0",
40 }
41 )
42 if sys.platform != "win32":
43 locale = "en_US.utf8" if sys.platform.startswith("linux") else "en_US.UTF-8"
44 session.config.env.update({"LC_ALL": locale, "LANG": locale})
45
46 session.config.update({"jinja": True, "subProcess": multiprocess})
47
48 args = ["run", "--no-debugger", "--with-threads"]
49 if multiprocess:
50 args += ["--reload"]
51 else:
52 args += ["--no-reload"]
53 args += ["--port", str(flask_server.port)]
54
55 if multiprocess and run.request == "attach":
56 # For multiproc attach, we need to use a helper stub to import debuggee
57 # before running Flask; otherwise, we will get the connection only from
58 # the subprocess, not from the Flask server process.
59 target = targets.Program(paths.main_py, args=args)
60 else:
61 target = targets.Module(name="flask", args=args)
62
63 return run(session, target, cwd=paths.flask1)
64
65 return start
66
67
68@pytest.mark.parametrize("bp_target", ["code", "template"])

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…