]> granicus.if.org Git - python/commitdiff
Avoid failing in test_urllibnet.test_bad_address when some overzealous
authorAntoine Pitrou <solipsis@pitrou.net>
Fri, 8 Jul 2011 17:19:57 +0000 (19:19 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Fri, 8 Jul 2011 17:19:57 +0000 (19:19 +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 03d1708fdd66b5bf0f399db6398ccb827ea99181..383b2affd09d6ec3c402d0d4638e04cf9c840c18 100644 (file)
@@ -113,6 +113,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 1518bd1fb115f3211aebc43224ea29afc0de7eed..e4ddb3cd5d93fc28b7f6b65db8e526cd6d556c2c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -16,6 +16,13 @@ Library
 - Issue #12467: warnings: fix a race condition if a warning is emitted at
   shutdown, if globals()['__file__'] is None.
 
+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.
+
 
 What's New in Python 3.2.1 release candidate 2?
 ===============================================