[Python-checkins] cpython: Issue #3583: mention that testing whether a bad address not triggering

brett.cannon python-checkins at python.org
Fri Jan 11 17:18:01 CET 2013


http://hg.python.org/cpython/rev/acce13a6e728
changeset:   81419:acce13a6e728
user:        Brett Cannon <brett at python.org>
date:        Fri Jan 11 11:17:53 2013 -0500
summary:
  Issue #3583: mention that testing whether a bad address not triggering
an OSError can mean a bad DNS server and not an actual bug.

files:
  Lib/test/test_urllibnet.py |  19 +++++++++----------
  1 files changed, 9 insertions(+), 10 deletions(-)


diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -121,16 +121,15 @@
         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(OSError,
-                          # SF patch 809915:  In Sep 2003, VeriSign started
-                          # highjacking invalid .com and .net addresses to
-                          # boost traffic to their own site.  This test
-                          # started failing then.  One hopes the .invalid
-                          # domain will be spared to serve its defined
-                          # purpose.
-                          # urllib.urlopen, "http://www.sadflkjsasadf.com/")
-                          urllib.request.urlopen,
-                          "http://sadflkjsasf.i.nvali.d/")
+        failure_explanation = ('opening an invalid URL did not raise OSError; '
+                               'can be caused by a broken DNS server '
+                               '(e.g. returns 404 or hijacks page)')
+        with self.assertRaises(OSError, msg=failure_explanation):
+            # SF patch 809915:  In Sep 2003, VeriSign started highjacking
+            # invalid .com and .net addresses to boost traffic to their own
+            # site.  This test started failing then.  One hopes the .invalid
+            # domain will be spared to serve its defined purpose.
+            urllib.request.urlopen("http://sadflkjsasf.i.nvali.d/")
 
 
 class urlretrieveNetworkTests(unittest.TestCase):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list