From 8b63d3af9f08c984331629c726d05794a1bbfc4a Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Sat, 25 Oct 2014 05:42:30 +0300 Subject: Issue #22596: support.transient_internet() now also catches ConnectionRefusedError exceptions wrapped by urllib.error.URLError. This change should fix sporadic failures in test_urllib2net. --- Lib/test/test_urllib2net.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'Lib/test/test_urllib2net.py') diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py index 51b7fc50ab..6f78cea1b7 100644 --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -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("" % url, file=sys.stderr) - continue - else: - raise else: try: with support.time_out, \ -- cgit v1.2.1