]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Avoid failing in test_urllibnet.test_bad_address when some overzealous
authorAntoine Pitrou <solipsis@pitrou.net>
Fri, 8 Jul 2011 17:14:19 +0000 (19:14 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Fri, 8 Jul 2011 17:14:19 +0000 (19:14 +0200)
DNS service (e.g. OpenDNS) resolves a non-existent domain name.  The test
is now skipped instead.

Lib/test/test_urllibnet.py
Misc/NEWS

index 8cba2dc779302fa044713fe253b135e9dea20d1f..1d88331146aaf90f27be56937ce4ff37d743ebe9 100644 (file)
@@ -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
index 1491862865a743a11f6ee94e68e93022f2dd3fd6..f7d12fc1d01ab679ca5df9522213f6670b1412ff 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -92,6 +92,10 @@ Build
 Tests
 -----
 
+- 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.
+
 - Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run
   test_tk or test_ttk_guionly under a username that is not currently logged
   in to the console windowserver (as may be the case under buildbot or ssh).