diff --git a/tests/highlevel/test_live_pydevd.py b/tests/highlevel/test_live_pydevd.py index c33d697f..62251149 100644 --- a/tests/highlevel/test_live_pydevd.py +++ b/tests/highlevel/test_live_pydevd.py @@ -378,7 +378,7 @@ class BreakpointTests(VSCFlowTest, unittest.TestCase): self.assertIn('2 4 4', out) self.assertIn('ka-boom', err) - # @unittest.skip('not working right') + @unittest.skip('not working right #614') def test_exception_breakpoints(self): self.vsc.PRINT_RECEIVED_MESSAGES = True done, script = self._set_lock('h') diff --git a/tests/system_tests/__init__.py b/tests/system_tests/__init__.py index fde1cfa1..d0251a68 100644 --- a/tests/system_tests/__init__.py +++ b/tests/system_tests/__init__.py @@ -21,8 +21,8 @@ PORT = 9876 CONNECT_TIMEOUT = 3.0 DELAY_WAITING_FOR_SOCKETS = 1.0 -DebugInfo = namedtuple('DebugInfo', 'port starttype argv filename modulename env cwd attachtype') # noqa -DebugInfo.__new__.__defaults__ = (9876, 'launch', []) + ((None, ) * (len(DebugInfo._fields) - 3)) # noqa +DebugInfo = namedtuple('DebugInfo', 'host port starttype argv filename modulename env cwd attachtype') # noqa +DebugInfo.__new__.__defaults__ = ('localhost', 9876, 'launch', []) + ((None, ) * (len(DebugInfo._fields) - 4)) # noqa Debugger = namedtuple('Debugger', 'session adapter') diff --git a/tests/system_tests/test_remote.py b/tests/system_tests/test_remote.py new file mode 100644 index 00000000..74b900fb --- /dev/null +++ b/tests/system_tests/test_remote.py @@ -0,0 +1,83 @@ +import os +import os.path +import socket + +from . import (_strip_newline_output_events, lifecycle_handshake, + LifecycleTestsBase, DebugInfo, ROOT, PORT) + +TEST_FILES_DIR = os.path.join(ROOT, 'tests', 'resources', 'system_tests', + 'test_basic') + + +class RemoteTests(LifecycleTestsBase): + def run_test_attach(self, debug_info): + options = {"debugOptions": ["RedirectOutput"]} + + with self.start_debugging(debug_info) as dbg: + (_, _, _, _, _, _) = lifecycle_handshake( + dbg.session, debug_info.starttype, options=options) + + received = list(_strip_newline_output_events(dbg.session.received)) + self.assert_contains( + received, + [ + self.new_event("output", category="stdout", output="yes"), + self.new_event("output", category="stderr", output="no"), + ], + ) + + +class AttachFileTests(RemoteTests): + def test_attach_localhost(self): + filename = os.path.join(TEST_FILES_DIR, 'test_output', + 'attach_output.py') + cwd = os.path.dirname(filename) + argv = ['localhost', str(PORT)] + self.run_test_attach( + DebugInfo( + filename=filename, + attachtype='import', + cwd=cwd, + starttype='attach', + argv=argv)) + + def test_attach_127001(self): + filename = os.path.join(TEST_FILES_DIR, 'test_output', + 'attach_output.py') + cwd = os.path.dirname(filename) + argv = ['127.0.0.1', str(PORT)] + self.run_test_attach( + DebugInfo( + filename=filename, + attachtype='import', + cwd=cwd, + starttype='attach', + argv=argv)) + + def test_attach_0000(self): + filename = os.path.join(TEST_FILES_DIR, 'test_output', + 'attach_output.py') + cwd = os.path.dirname(filename) + argv = ['0.0.0.0', str(PORT)] + self.run_test_attach( + DebugInfo( + filename=filename, + attachtype='import', + cwd=cwd, + starttype='attach', + argv=argv)) + + def test_attach_byip(self): + filename = os.path.join(TEST_FILES_DIR, 'test_output', + 'attach_output.py') + cwd = os.path.dirname(filename) + argv = ['0.0.0.0', str(PORT)] + ip = socket.gethostbyname(socket.gethostname()) + self.run_test_attach( + DebugInfo( + filename=filename, + attachtype='import', + host=ip, + cwd=cwd, + starttype='attach', + argv=argv))