diff --git a/tobiko/shell/ping/_ping.py b/tobiko/shell/ping/_ping.py index 0bd94466e..cae3d8387 100644 --- a/tobiko/shell/ping/_ping.py +++ b/tobiko/shell/ping/_ping.py @@ -331,10 +331,10 @@ def execute_ping(parameters, ssh_client=None, check=True): timeout=parameters.deadline + 3., expect_exit_status=None, network_namespace=parameters.network_namespace) - except sh.ShellError as ex: + except (sh.ShellError, tobiko.RetryLimitError) as ex: LOG.exception("Error executing ping command") - stdout = ex.stdout - stderr = ex.stderr + stdout = ex.stdout if hasattr(ex, "stdout") else None + stderr = ex.stderr if hasattr(ex, "stderr") else None else: stdout = result.stdout stderr = result.stderr diff --git a/tobiko/shell/sh/_process.py b/tobiko/shell/sh/_process.py index d9a2c541a..8f19407a7 100644 --- a/tobiko/shell/sh/_process.py +++ b/tobiko/shell/sh/_process.py @@ -352,11 +352,12 @@ class ShellProcessFixture(tobiko.SharedFixture): attempt.check_limits() except tobiko.RetryTimeLimitError: LOG.exception("retry timeout expired") + # Eventually raises either ShellCommandTimeout exception or + # RetryTimeLimitError + self.get_exit_status(timeout=timeout) + raise else: return - # Eventually raises ShellCommandTimeout exception - self.get_exit_status(timeout=timeout) - raise StopIteration def _is_communicating(self, streams, send, receive): if send and self.stdin in streams: