()
| 19 | def 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…