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

Function test_targets

tests/debugpy/server/test_cli.py:95–147  ·  view source on GitHub ↗
(cli, target_kind, mode, address, wait_for_client, script_args)

Source from the content-addressed store, hash-verified

93@pytest.mark.parametrize("wait_for_client", ["", "wait_for_client"])
94@pytest.mark.parametrize("script_args", ["", "script_args"])
95def test_targets(cli, target_kind, mode, address, wait_for_client, script_args):
96 expected_options = {
97 "mode": mode,
98 "target_kind": target_kind,
99 "wait_for_client": False
100 }
101
102 args = ["--" + mode, address]
103
104 host, sep, port = address.rpartition(":")
105 host = host.strip("[]")
106 if sep:
107 expected_options["address"] = (host, int(port))
108 else:
109 expected_options["address"] = ("127.0.0.1", int(address))
110
111 if wait_for_client:
112 args += ["--wait-for-client"]
113 expected_options["wait_for_client"] = True
114
115 if target_kind == "file":
116 target = "spam.py"
117 args += [target]
118 elif target_kind == "module":
119 target = "spam"
120 args += ["-m", target]
121 elif target_kind == "code":
122 target = "123"
123 args += ["-c", target]
124 else:
125 pytest.fail(target_kind)
126 expected_options["target"] = target
127
128 if script_args:
129 script_args = [
130 "ham",
131 "--listen",
132 "--wait-for-client",
133 "-y",
134 "spam",
135 "--",
136 "--connect",
137 "-c",
138 "--something",
139 "-m",
140 ]
141 args += script_args
142 else:
143 script_args = []
144
145 argv, options = cli(args)
146 assert argv == script_args
147 assert options == some.dict.containing(expected_options)
148
149@pytest.mark.parametrize("value", [True, False])
150def test_configure_subProcess(cli, value):

Callers

nothing calls this directly

Calls 1

cliFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…