From 6b5a38c728bbca3273b6917308559cf22e298531 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Sat, 25 May 2013 13:08:13 +0200 Subject: [PATCH] Fix test_bad_address on Ubuntu 13.04 --- Lib/test/test_urllibnet.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index d3fe69dbcef..20efca6adbf 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