mirror of
https://github.com/certbot/certbot.git
synced 2026-07-30 18:04:31 +02:00
[#4535] - Unwrap max retries exceeded errors
This commit is contained in:
+1
-1
@@ -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 ]*)"
|
err_regex = r".*host='(\S*)'.*Max retries exceeded with url\: (\/\w*).*(\[Errno \d+\])([A-Za-z ]*)"
|
||||||
m = re.match(err_regex, str(e))
|
m = re.match(err_regex, str(e))
|
||||||
if m is None:
|
if m is None:
|
||||||
raise # pragma: no cover
|
raise #pragma: no cover
|
||||||
else:
|
else:
|
||||||
host, path, _err_no, err_msg = m.groups()
|
host, path, _err_no, err_msg = m.groups()
|
||||||
raise ValueError("Requesting {0}{1}:{2}".format(host, path, err_msg))
|
raise ValueError("Requesting {0}{1}:{2}".format(host, path, err_msg))
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ from six.moves import http_client # pylint: disable=import-error
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
import requests
|
import requests
|
||||||
import sys
|
|
||||||
|
|
||||||
from acme import challenges
|
from acme import challenges
|
||||||
from acme import errors
|
from acme import errors
|
||||||
@@ -630,21 +629,8 @@ class ClientNetworkTest(unittest.TestCase):
|
|||||||
|
|
||||||
# Python Exceptions
|
# Python Exceptions
|
||||||
except ValueError as y:
|
except ValueError as y:
|
||||||
if "linux" in sys.platform:
|
self.assertEqual("Requesting localhost/nonexistent: "
|
||||||
self.assertEqual("Requesting localhost/nonexistent: "
|
"Connection refused", str(y))
|
||||||
"Connection refused", str(y))
|
|
||||||
else: #pragma: no cover
|
|
||||||
self.assertEqual("Requesting localhost/nonexistent: "
|
|
||||||
"Connection refused", str(y))
|
|
||||||
|
|
||||||
# Requests Exceptions
|
|
||||||
except requests.exceptions.ConnectionError as z: #pragma: no cover
|
|
||||||
if "linux" in sys.platform:
|
|
||||||
self.assertEqual("('Connection aborted.', "
|
|
||||||
"error(111, 'Connection refused'))", str(z))
|
|
||||||
else: #pragma: no cover
|
|
||||||
self.assertEqual("('Connection aborted.', "
|
|
||||||
"error('Connection refused'))", str(z))
|
|
||||||
|
|
||||||
class ClientNetworkWithMockedResponseTest(unittest.TestCase):
|
class ClientNetworkWithMockedResponseTest(unittest.TestCase):
|
||||||
"""Tests for acme.client.ClientNetwork which mock out response."""
|
"""Tests for acme.client.ClientNetwork which mock out response."""
|
||||||
|
|||||||
Reference in New Issue
Block a user