(pyfile, host)
| 270 | |
| 271 | @pytest.mark.parametrize("host", ["127.0.0.1", "::1"]) |
| 272 | def test_cancel_wait(pyfile, host): |
| 273 | @pyfile |
| 274 | def code_to_debug(): |
| 275 | import debugpy |
| 276 | import sys |
| 277 | import threading |
| 278 | import time |
| 279 | |
| 280 | from debuggee import backchannel |
| 281 | |
| 282 | def cancel(): |
| 283 | time.sleep(1) |
| 284 | debugpy.wait_for_client.cancel() |
| 285 | |
| 286 | _, host, port = sys.argv |
| 287 | port = int(port) |
| 288 | debugpy.listen(address=(host, port)) |
| 289 | threading.Thread(target=cancel).start() |
| 290 | debugpy.wait_for_client() |
| 291 | backchannel.send("exit") |
| 292 | |
| 293 | with debug.Session() as session: |
| 294 | host = runners.attach_connect.host if host == "127.0.0.1" else host |
| 295 | port = runners.attach_connect.port |
| 296 | session.config.update({"connect": {"host": host, "port": port}}) |
| 297 | session.expected_exit_code = None |
| 298 | |
| 299 | backchannel = session.open_backchannel() |
| 300 | session.spawn_debuggee( |
| 301 | [ |
| 302 | code_to_debug, |
| 303 | host, |
| 304 | port, |
| 305 | ] |
| 306 | ) |
| 307 | |
| 308 | assert backchannel.receive() == "exit" |
nothing calls this directly
no test coverage detected
searching dependent graphs…