diff --git a/tests/debug/comms.py b/tests/debug/comms.py index a46ad5ca..f83f90fa 100644 --- a/tests/debug/comms.py +++ b/tests/debug/comms.py @@ -27,6 +27,7 @@ class BackChannel(object): self._server_socket = sockets.create_server("127.0.0.1", 0, self.TIMEOUT) _, self.port = sockets.get_address(self._server_socket) self._server_socket.listen(0) + log.info("{0} created server socket on port {1}", self, self.port) def accept_worker(): log.info( @@ -67,8 +68,14 @@ class BackChannel(object): self._established.set() def receive(self): - self._established.wait() - return self._stream.read_json() + log.info("{0} waiting for connection to be established...", self) + if not self._established.wait(timeout=self.TIMEOUT): + log.error("{0} timed out waiting for connection after {1} seconds", self, self.TIMEOUT) + raise TimeoutError(f"{self} timed out waiting for debuggee to connect") + log.info("{0} connection established, reading JSON...", self) + result = self._stream.read_json() + log.info("{0} received: {1}", self, result) + return result def send(self, value): self.session.timeline.unfreeze() diff --git a/tests/debugpy/test_args.py b/tests/debugpy/test_args.py index 639615c6..b17db78f 100644 --- a/tests/debugpy/test_args.py +++ b/tests/debugpy/test_args.py @@ -41,6 +41,13 @@ def test_args(pyfile, target, run): def test_shell_expansion(pyfile, tmpdir, target, run, expansion, python_with_space): if expansion == "expand" and run.console == "internalConsole": pytest.skip('Shell expansion is not supported for "internalConsole"') + + # Skip tests with python_with_space=True and target="code" on Windows with runInTerminal + # because cmd.exe cannot properly handle multiline string arguments when invoking a .cmd wrapper + if (python_with_space and target == targets.Code and + run.console in ("integratedTerminal", "externalTerminal") and + sys.platform == "win32"): + pytest.skip('Windows cmd.exe cannot handle multiline code arguments with .cmd wrapper') @pyfile def code_to_debug():