]> granicus.if.org Git - python/commitdiff
Fix test_bad_address on Ubuntu 13.04
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 25 May 2013 11:08:13 +0000 (13:08 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 25 May 2013 11:08:13 +0000 (13:08 +0200)
Lib/test/test_urllibnet.py

index d3fe69dbcef73aef737f262a7b5568cf2b8b9fb2..20efca6adbff3daacad7e86128589427f0ce5d88 100644 (file)
@@ -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