Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6b5a38c

Browse files
committed
Fix test_bad_address on Ubuntu 13.04
1 parent 3b08a29 commit 6b5a38c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/test/test_urllibnet.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ def test_bad_address(self):
116116
bogus_domain = "sadflkjsasf.i.nvali.d"
117117
try:
118118
socket.gethostbyname(bogus_domain)
119-
except socket.gaierror:
119+
except OSError:
120+
# socket.gaierror is too narrow, since getaddrinfo() may also
121+
# fail with EAI_SYSTEM and ETIMEDOUT (seen on Ubuntu 13.04),
122+
# i.e. Python's TimeoutError.
120123
pass
121124
else:
122125
# This happens with some overzealous DNS providers such as OpenDNS

0 commit comments

Comments
 (0)