diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2014-10-25 02:42:30 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2014-10-25 02:42:30 (GMT) |
commit | 8b63d3af9f08c984331629c726d05794a1bbfc4a (patch) | |
tree | 50498c800837f150d7442686f89ea86463c1e975 /Lib/test/support | |
parent | 6d1c149a46f274392d2d2adda998e64017e42030 (diff) | |
download | cpython-8b63d3af9f08c984331629c726d05794a1bbfc4a.zip cpython-8b63d3af9f08c984331629c726d05794a1bbfc4a.tar.gz cpython-8b63d3af9f08c984331629c726d05794a1bbfc4a.tar.bz2 |
Issue #22596: support.transient_internet() now also catches
ConnectionRefusedError exceptions wrapped by urllib.error.URLError.
This change should fix sporadic failures in test_urllib2net.
Diffstat (limited to 'Lib/test/support')
-rw-r--r-- | Lib/test/support/__init__.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index f2c1a92..adebedd 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -25,6 +25,7 @@ import sysconfig import tempfile import time import unittest +import urllib.error import warnings try: @@ -1307,6 +1308,8 @@ def transient_internet(resource_name, *, timeout=30.0, errnos=()): n = getattr(err, 'errno', None) if (isinstance(err, socket.timeout) or (isinstance(err, socket.gaierror) and n in gai_errnos) or + (isinstance(err, urllib.error.URLError) and + "ConnectionRefusedError" in err.reason) or n in captured_errnos): if not verbose: sys.stderr.write(denied.args[0] + "\n") |