diff options
-rw-r--r-- | Lib/test/test_urllibnet.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index d3fe69d..20efca6 100644 --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -116,7 +116,10 @@ class urlopenNetworkTests(unittest.TestCase): bogus_domain = "sadflkjsasf.i.nvali.d" try: socket.gethostbyname(bogus_domain) - except socket.gaierror: + except OSError: + # socket.gaierror is too narrow, since getaddrinfo() may also + # fail with EAI_SYSTEM and ETIMEDOUT (seen on Ubuntu 13.04), + # i.e. Python's TimeoutError. pass else: # This happens with some overzealous DNS providers such as OpenDNS |