diff --git a/acme/acme/client.py b/acme/acme/client.py index 6fcee2fdc..2e07d34d7 100644 --- a/acme/acme/client.py +++ b/acme/acme/client.py @@ -647,7 +647,7 @@ class ClientNetwork(object): # pylint: disable=too-many-instance-attributes err_regex = r".*host='(\S*)'.*Max retries exceeded with url\: (\/\w*).*(\[Errno \d+\])([A-Za-z ]*)" m = re.match(err_regex, str(e)) if m is None: - raise #pragma: no cover + raise # pragma: no cover else: host, path, _err_no, err_msg = m.groups() raise ValueError("Requesting {0}{1}:{2}".format(host, path, err_msg)) diff --git a/acme/acme/client_test.py b/acme/acme/client_test.py index ff0ac18ef..6e6a0fecd 100644 --- a/acme/acme/client_test.py +++ b/acme/acme/client_test.py @@ -627,11 +627,15 @@ class ClientNetworkTest(unittest.TestCase): # pylint: disable=protected-access self.net._send_request('GET', "http://localhost:19123/nonexistent.txt") - # Python Exceptions + # Value Error Generated Exceptions except ValueError as y: self.assertEqual("Requesting localhost/nonexistent: " "Connection refused", str(y)) + # Requests Library Exceptions + except requests.exceptions.RequestException as z: + self.assertEqual("('Connection aborted.', error(111, 'Connection refused'))", str(z)) + class ClientNetworkWithMockedResponseTest(unittest.TestCase): """Tests for acme.client.ClientNetwork which mock out response.""" # pylint: disable=too-many-instance-attributes