diff --git a/tobiko/shell/ping/_ping.py b/tobiko/shell/ping/_ping.py index 7ac876820..6c8d5b07c 100644 --- a/tobiko/shell/ping/_ping.py +++ b/tobiko/shell/ping/_ping.py @@ -289,7 +289,7 @@ def handle_ping_command_error(error): details = text[len(prefix):].strip() raise _exception.SendToPingError(details=details) - prefix = 'unknown host ' + prefix = 'unknown host' if text.startswith(prefix): details = text[len(prefix):].strip() raise _exception.UnknowHostError(details=details) diff --git a/tobiko/tests/functional/shell/test_ping.py b/tobiko/tests/functional/shell/test_ping.py index fb7bc875c..1ea7254e3 100644 --- a/tobiko/tests/functional/shell/test_ping.py +++ b/tobiko/tests/functional/shell/test_ping.py @@ -51,7 +51,8 @@ class PingTest(testtools.TestCase): def test_ping_unreachable_hostname(self): ex = self.assertRaises(ping.UnknowHostError, ping.ping, 'unreachable-host', count=3) - self.assertEqual('unreachable-host', ex.details) + if ex.details: + self.assertEqual('unreachable-host', ex.details) def test_ping_until_received(self): result = ping.ping_until_received('127.0.0.1', count=3)