From e54cf6be5aed36177ca028b159054905a863f30a Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Thu, 30 Aug 2018 10:46:20 -0700 Subject: [PATCH] Switch to using suspend-all/resume-all command (#775) * Switch to using suspend all command * Update tests --- ptvsd/wrapper.py | 13 +++---------- tests/highlevel/test_messages.py | 10 +++------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/ptvsd/wrapper.py b/ptvsd/wrapper.py index fe1e21b3f..c36281418 100644 --- a/ptvsd/wrapper.py +++ b/ptvsd/wrapper.py @@ -1491,9 +1491,7 @@ def _clear_breakpoints(self): # TODO: Wait until the last request has been handled? def _resume_all_threads(self): - # TODO: Replace this with resume all command after #732 is fixed - for pyd_tid in self.thread_map.pydevd_ids(): - self.pydevd_notify(pydevd_comm.CMD_THREAD_RUN, pyd_tid) + self.pydevd_notify(pydevd_comm.CMD_THREAD_RUN, '*') def send_process_event(self, start_method): # TODO: docstring @@ -2014,18 +2012,13 @@ def on_pause(self, request, args): return # Always suspend all threads. - # TODO: Replace this with suspend all command after #732 is fixed - for pyd_tid in self.thread_map.pydevd_ids(): - self.pydevd_notify(pydevd_comm.CMD_THREAD_SUSPEND, pyd_tid) + self.pydevd_notify(pydevd_comm.CMD_THREAD_SUSPEND, '*') self.send_response(request) @async_handler def on_continue(self, request, args): - # TODO: docstring # Always continue all threads. - # TODO: Replace this with resume all command after #732 is fixed - for pyd_tid in self.thread_map.pydevd_ids(): - self.pydevd_notify(pydevd_comm.CMD_THREAD_RUN, pyd_tid) + self.pydevd_notify(pydevd_comm.CMD_THREAD_RUN, '*') self.send_response(request, allThreadsContinued=True) @async_handler diff --git a/tests/highlevel/test_messages.py b/tests/highlevel/test_messages.py index cefc4a5f4..9fa84f69c 100644 --- a/tests/highlevel/test_messages.py +++ b/tests/highlevel/test_messages.py @@ -844,9 +844,7 @@ def test_pause(self): # no events ]) - expected = [self.expected_pydevd_request('1')] - for _, t in threads: - expected.append(self.expected_pydevd_request(str(t.id))) + expected = [self.expected_pydevd_request('*')] self.assert_received_unordered_payload(self.debugger, expected) @@ -873,10 +871,8 @@ def test_basic(self): self.expected_response(allThreadsContinued=True), # no events ]) - thread_ids = list(t.id for t in self._known_threads) - expected = list(self.debugger_msgs.new_request( - self.PYDEVD_CMD, str(t)) - for t in thread_ids) + + expected = [self.debugger_msgs.new_request(self.PYDEVD_CMD, '*')] self.assert_contains(self.debugger.received, expected, parser=self.debugger.protocol)