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

Function test_with_dot_remote_root

tests/debugpy/test_path_mapping.py:20–57  ·  view source on GitHub ↗
(pyfile, long_tmpdir, target, run)

Source from the content-addressed store, hash-verified

18
19
20def test_with_dot_remote_root(pyfile, long_tmpdir, target, run):
21 @pyfile
22 def code_to_debug():
23 import os
24 import debuggee
25 from debuggee import backchannel
26
27 debuggee.setup()
28 backchannel.send(os.path.abspath(__file__))
29 print("done") # @bp
30
31 dir_local = long_tmpdir.mkdir("local")
32 dir_remote = long_tmpdir.mkdir("remote")
33
34 path_local = dir_local / "code_to_debug.py"
35 path_remote = dir_remote / "code_to_debug.py"
36
37 code_to_debug.copy(path_local)
38 code_to_debug.copy(path_remote)
39
40 with debug.Session() as session:
41 session.config["pathMappings"] = [{"localRoot": dir_local, "remoteRoot": "."}]
42
43 backchannel = session.open_backchannel()
44 with run(session, target(path_remote), cwd=dir_remote):
45 # Set breakpoints using local path. This tests that local paths are
46 # mapped to remote paths.
47 session.set_breakpoints(path_local, all)
48
49 actual_path_remote = backchannel.receive()
50 assert some.path(actual_path_remote) == path_remote
51
52 session.wait_for_stop(
53 "breakpoint",
54 expected_frames=[some.dap.frame(some.dap.source(path_local), line="bp")],
55 )
56
57 session.request_continue()
58
59
60def test_with_path_mappings(pyfile, long_tmpdir, target, run):

Callers

nothing calls this directly

Calls 10

open_backchannelMethod · 0.80
set_breakpointsMethod · 0.80
receiveMethod · 0.80
pathMethod · 0.80
wait_for_stopMethod · 0.80
request_continueMethod · 0.80
runFunction · 0.70
targetFunction · 0.70
copyMethod · 0.45
sourceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…