Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Switch to using suspend-all/resume-all command (#775)
Browse files Browse the repository at this point in the history
* Switch to using suspend all command

* Update tests
  • Loading branch information
karthiknadig authored Aug 30, 2018
1 parent 6668cee commit e54cf6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
13 changes: 3 additions & 10 deletions ptvsd/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions tests/highlevel/test_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand Down

0 comments on commit e54cf6b

Please sign in to comment.