summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-07 21:44:17 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-07 21:44:17 (GMT)
commitdae0c63fc8b2b35d0e379e74afd5d6684a74323e (patch)
treef3561af9fa97ed8760eeaedd7ead01cb4b331494 /Lib
parent4d7979be72ed728f3b334037d59a218314c28550 (diff)
downloadcpython-dae0c63fc8b2b35d0e379e74afd5d6684a74323e.zip
cpython-dae0c63fc8b2b35d0e379e74afd5d6684a74323e.tar.gz
cpython-dae0c63fc8b2b35d0e379e74afd5d6684a74323e.tar.bz2
Merged revisions 84604 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84604 | antoine.pitrou | 2010-09-07 23:43:31 +0200 (mar., 07 sept. 2010) | 3 lines Also catch some gaierrors ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/support.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index 8ef87c2..3bb08d9 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -624,16 +624,25 @@ def transient_internet(resource_name, *, timeout=30.0, errnos=()):
('ENETUNREACH', 101),
('ETIMEDOUT', 110),
]
+ default_gai_errnos = [
+ ('EAI_NONAME', -2),
+ ('EAI_NODATA', -5),
+ ]
denied = ResourceDenied("Resource '%s' is not available" % resource_name)
captured_errnos = errnos
+ gai_errnos = []
if not captured_errnos:
captured_errnos = [getattr(errno, name, num)
for (name, num) in default_errnos]
+ gai_errnos = [getattr(socket, name, num)
+ for (name, num) in default_gai_errnos]
def filter_error(err):
+ n = getattr(err, 'errno', None)
if (isinstance(err, socket.timeout) or
- getattr(err, 'errno', None) in captured_errnos):
+ (isinstance(err, socket.gaierror) and n in gai_errnos) or
+ n in captured_errnos):
if not verbose:
sys.stderr.write(denied.args[0] + "\n")
raise denied from err