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

Function test_cancel_wait

tests/debugpy/test_attach.py:272–308  ·  view source on GitHub ↗
(pyfile, host)

Source from the content-addressed store, hash-verified

270
271@pytest.mark.parametrize("host", ["127.0.0.1", "::1"])
272def 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"

Callers

nothing calls this directly

Calls 4

open_backchannelMethod · 0.80
spawn_debuggeeMethod · 0.80
receiveMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…