mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #22596: support.transient_internet() now also catches
ConnectionRefusedError exceptions wrapped by urllib.error.URLError. This change should fix sporadic failures in test_urllib2net.
This commit is contained in:
parent
6d1c149a46
commit
8b63d3af9f
2 changed files with 4 additions and 6 deletions
|
@ -229,6 +229,7 @@ class OtherNetworkTests(unittest.TestCase):
|
|||
with support.transient_internet(url):
|
||||
try:
|
||||
f = urlopen(url, req, TIMEOUT)
|
||||
# urllib.error.URLError is a subclass of OSError
|
||||
except OSError as err:
|
||||
if expected_err:
|
||||
msg = ("Didn't get expected error(s) %s for %s %s, got %s: %s" %
|
||||
|
@ -236,12 +237,6 @@ class OtherNetworkTests(unittest.TestCase):
|
|||
self.assertIsInstance(err, expected_err, msg)
|
||||
else:
|
||||
raise
|
||||
except urllib.error.URLError as err:
|
||||
if isinstance(err[0], socket.timeout):
|
||||
print("<timeout: %s>" % url, file=sys.stderr)
|
||||
continue
|
||||
else:
|
||||
raise
|
||||
else:
|
||||
try:
|
||||
with support.time_out, \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue