diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-08 19:14:19 +0200 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-08 19:14:19 +0200 |
commit | a4d58d26a187a73b66253c888ccea048f45fec0d (patch) | |
tree | c84fe7eb09f876e5a36b83974c09eb2e2b71c42a /Lib/test/test_urllibnet.py | |
parent | 8703be94b197ca7fdec8270705bbfefae232ee5b (diff) | |
download | cpython-git-a4d58d26a187a73b66253c888ccea048f45fec0d.tar.gz |
Avoid failing in test_urllibnet.test_bad_address when some overzealous
DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test
is now skipped instead.
Diffstat (limited to 'Lib/test/test_urllibnet.py')
-rw-r--r-- | Lib/test/test_urllibnet.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index 8cba2dc779..1d88331146 100644 --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -131,6 +131,14 @@ class urlopenNetworkTests(unittest.TestCase): def test_bad_address(self): # Make sure proper exception is raised when connecting to a bogus # address. + bogus_domain = "sadflkjsasf.i.nvali.d" + try: + socket.gethostbyname(bogus_domain) + except socket.gaierror: + pass + else: + # This happens with some overzealous DNS providers such as OpenDNS + self.skipTest("%r should not resolve for test to work" % bogus_domain) self.assertRaises(IOError, # SF patch 809915: In Sep 2003, VeriSign started # highjacking invalid .com and .net addresses to |