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

Function test_custom_python

tests/debugpy/test_run.py:209–246  ·  view source on GitHub ↗
(
    pyfile, tmpdir, run, target, debuggee_custompy, launcher_custompy
)

Source from the content-addressed store, hash-verified

207@pytest.mark.parametrize("debuggee_custompy", [None, "launcher"])
208@pytest.mark.parametrize("launcher_custompy", [None, "debuggee"])
209def test_custom_python(
210 pyfile, tmpdir, run, target, debuggee_custompy, launcher_custompy
211):
212 @pyfile
213 def code_to_debug():
214 import os
215
216 import debuggee
217 from debuggee import backchannel
218
219 debuggee.setup()
220 backchannel.send(os.getenv("DEBUGPY_CUSTOM_PYTHON"))
221
222 expected = ""
223 if debuggee_custompy:
224 debuggee_custompy = make_custompy(tmpdir, "debuggee")
225 expected += "debuggee;"
226 if launcher_custompy:
227 launcher_custompy = make_custompy(tmpdir, "launcher")
228 expected += "launcher;"
229 else:
230 # If "python" is set, it also becomes the default for "debugLauncherPython"
231 expected *= 2
232 if not len(expected):
233 pytest.skip()
234
235 with debug.Session() as session:
236 session.config.pop("python", None)
237 if launcher_custompy:
238 session.config["debugLauncherPython"] = launcher_custompy
239 if debuggee_custompy:
240 session.config["python"] = debuggee_custompy
241
242 backchannel = session.open_backchannel()
243 with run(session, target(code_to_debug)):
244 pass
245
246 assert backchannel.receive() == expected
247
248
249@pytest.mark.parametrize("run", runners.all_launch)

Callers

nothing calls this directly

Calls 6

make_custompyFunction · 0.85
popMethod · 0.80
open_backchannelMethod · 0.80
receiveMethod · 0.80
runFunction · 0.70
targetFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…