summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-07-08 17:19:57 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-07-08 17:19:57 (GMT)
commit72fff046a6d96131d2a929699e6fc8875f57e452 (patch)
treedff6a41c7d6a352f4673a79d5ead7144647330e1
parentb9ac25d1c394714f0565845b274e7eebb402f1e7 (diff)
downloadcpython-72fff046a6d96131d2a929699e6fc8875f57e452.zip
cpython-72fff046a6d96131d2a929699e6fc8875f57e452.tar.gz
cpython-72fff046a6d96131d2a929699e6fc8875f57e452.tar.bz2
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.
-rw-r--r--Lib/test/test_urllibnet.py8
-rw-r--r--Misc/NEWS4
2 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
index 03d1708..383b2af 100644
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -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
diff --git a/Misc/NEWS b/Misc/NEWS
index 018d799..e415b4a 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -47,6 +47,10 @@ C-API
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 #12440: When testing whether some bits in SSLContext.options can be
reset, check the version of the OpenSSL headers Python was compiled against,
rather than the runtime version of the OpenSSL library.