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

Function code_to_debug

tests/debugpy/test_attach.py:21–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19def test_attach_api(pyfile, host, wait_for_client, is_client_connected, stop_method):
20 @pyfile
21 def code_to_debug():
22 import debuggee
23 import debugpy
24 import sys
25 import time
26 from debuggee import backchannel, scratchpad
27
28 # Test different ways of calling configure().
29 debugpy.configure(qt="none", subProcess=True, python=sys.executable)
30 debugpy.configure({"qt": "none", "subProcess": True, "python": sys.executable})
31 debugpy.configure({"qt": "none"}, python=sys.executable)
32
33 debuggee.setup()
34 _, host, port, wait_for_client, is_client_connected, stop_method = sys.argv
35 port = int(port)
36 debugpy.listen(address=(host, port))
37
38 if wait_for_client:
39 backchannel.send("wait_for_client")
40 debugpy.wait_for_client()
41
42 if is_client_connected:
43 backchannel.send("is_client_connected")
44 while not debugpy.is_client_connected():
45 print("looping until is_client_connected()")
46 time.sleep(0.1)
47
48 if stop_method == "breakpoint":
49 backchannel.send("breakpoint?")
50 assert backchannel.receive() == "proceed"
51 debugpy.breakpoint()
52 print("break") # @breakpoint
53 else:
54 scratchpad["paused"] = False
55 backchannel.send("loop?")
56 assert backchannel.receive() == "proceed"
57 while not scratchpad["paused"]:
58 print("looping until paused")
59 time.sleep(0.1)
60
61 with debug.Session() as session:
62 host = runners.attach_connect.host if host == "127.0.0.1" else host

Callers

nothing calls this directly

Calls 8

objectFunction · 0.85
listenMethod · 0.80
receiveMethod · 0.80
breakpointMethod · 0.80
do_somethingFunction · 0.70
configureMethod · 0.45
sendMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…