Wait for commands instead of just expecting them.

This commit is contained in:
Eric Snow 2018-04-02 14:37:30 -06:00
parent cdd42180ba
commit b18b9ced29

View file

@ -287,8 +287,8 @@ class PyDevdLifecycle(object):
@contextlib.contextmanager
def _wait_for_initialized(self):
with self._fix.expect_command(CMD_REDIRECT_OUTPUT):
with self._fix.expect_command(CMD_RUN):
with self._fix.wait_for_command(CMD_REDIRECT_OUTPUT):
with self._fix.wait_for_command(CMD_RUN):
yield
def _initialize(self):
@ -529,6 +529,13 @@ class PyDevdFixture(FixtureBase):
if self._hidden:
self.msgs.next_request()
@contextlib.contextmanager
def wait_for_command(self, cmdid, *args, **kwargs):
with self.fake.wait_for_command(cmdid, *args, **kwargs):
yield
if self._hidden:
self.msgs.next_request()
def set_response(self, cmdid, payload, **kwargs):
self.fake.add_pending_response(cmdid, payload, **kwargs)
if self._hidden: