diff options
author | Florian Bruhin <me@the-compiler.org> | 2020-07-16 18:52:11 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2020-07-16 18:52:11 +0200 |
commit | e5de7783d092f273a8a61fa5641c868c3f28bb8e (patch) | |
tree | 1ba56ddcfc41d86b1d4ac2ecaf382c8e5bfa4895 /tests/end2end/fixtures/quteprocess.py | |
parent | 1506b6f212726276da8ed5478a8e823945f18776 (diff) | |
download | qutebrowser-e5de7783d092f273a8a61fa5641c868c3f28bb8e.tar.gz qutebrowser-e5de7783d092f273a8a61fa5641c868c3f28bb8e.zip |
tests: Retry sending IPC messages
See https://github.com/qutebrowser/qutebrowser/issues/5390#issuecomment-620114026
Diffstat (limited to 'tests/end2end/fixtures/quteprocess.py')
-rw-r--r-- | tests/end2end/fixtures/quteprocess.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index edaeb2ccc..5357d6a1e 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -691,6 +691,11 @@ class QuteProc(testprocess.Process): finally: super().after_test() + def _wait_for_ipc(self): + """Wait for an IPC message to arrive.""" + self.wait_for(category='ipc', module='ipc', function='on_ready_read', + message='Read from socket *') + def send_ipc(self, commands, target_arg=''): """Send a raw command to the running IPC socket.""" delay = self.request.config.getoption('--qute-delay') @@ -698,8 +703,14 @@ class QuteProc(testprocess.Process): assert self._ipc_socket is not None ipc.send_to_running_instance(self._ipc_socket, commands, target_arg) - self.wait_for(category='ipc', module='ipc', function='on_ready_read', - message='Read from socket *') + + try: + self._wait_for_ipc() + except testprocess.WaitForTimeout: + # Sometimes IPC messages seem to get lost on Windows CI? + # Retry a second time as this shouldn't make tests fail. + ipc.send_to_running_instance(self._ipc_socket, commands, target_arg) + self._wait_for_ipc() def start(self, *args, wait_focus=True, **kwargs): # pylint: disable=arguments-differ |