Issue 3583: test_urllibnet.test_bad_address() fails when using OpenDNS (original) (raw)

Created on 2008-08-17 21:21 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (7)
msg71292 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-08-17 21:21
OpenDNS has a "feature" where if you enter an address that doesn't exist, you get a 404 and a Google-looking search page. Problem is that urllib.urlopen() does not raise any exception on a 404. Probably should just change the test such that if no exception is raised, check if a 404 was returned and still consider the test passed.
msg71319 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-08-18 10:52
Are many people using OpenDNS? Is there a way to detect that OpenDNS is being used and trigger a separate path in the test? I say that because returning a 404 when the domain lookup has failed is wrong. Perhaps the test should check for a 404 and still raise an exception, but with an appropriate message indicating that it may be due to a "featureful" DNS service.
msg71352 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-08-18 17:19
On Mon, Aug 18, 2008 at 3:52 AM, Antoine Pitrou <report@bugs.python.org> wrote: > > Antoine Pitrou <pitrou@free.fr> added the comment: > > Are many people using OpenDNS? Is there a way to detect that OpenDNS is > being used and trigger a separate path in the test? > I say that because returning a 404 when the domain lookup has failed is > wrong. Perhaps the test should check for a 404 and still raise an > exception, but with an appropriate message indicating that it may be due > to a "featureful" DNS service. > That's also a possibility. Out of curiosity, what HTTP response should be received?
msg71353 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-08-18 17:50
Le lundi 18 août 2008 à 17:19 +0000, Brett Cannon a écrit : > That's also a possibility. > > Out of curiosity, what HTTP response should be received? There shouldn't be an HTTP response at all. If DNS lookup fails, connecting to the server simply fails.
msg87786 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2009-05-15 01:39
I got a similar problem but here the ISP returned an error/search page and a "302 Found". test_urllibnet.test_bad_address() failed with "AssertionError: IOError not raised by urlopen" >>> import http.client >>> conn = http.client.HTTPConnection("www.somerandominvalidpage.edu") >>> conn.request("GET", "/") >>> r1 = conn.getresponse() >>> r1.status, r1.reason (302, 'Found') test_xmlrpc_net failed for the same reason (see #6027).
msg124676 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-26 19:30
I think the best we can do here is add a message explaining that the error may be due to a broken DNS server (one with a wildcard dns record for all non-existent top level domains). However, assertRaises, even in context manager form, doesn't take a msg argument (yet). I've opened an issue with a feature request to fix that and made it a dependency of this issue. Note that the test uses a domain name ending in ".d", and for a while before that used '.invalid', so the test should not fail if the ISP is only capturing valid top level domains with wildcards, something that seems to be far more common than catching invalid domains.
msg179693 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-01-11 16:18
New changeset acce13a6e728 by Brett Cannon in branch 'default': Issue #3583: mention that testing whether a bad address not triggering http://hg.python.org/cpython/rev/acce13a6e728
History
Date User Action Args
2022-04-11 14:56:37 admin set github: 47833
2013-01-11 16🔞15 brett.cannon set status: open -> closedresolution: fixed
2013-01-11 16🔞00 python-dev set nosy: + python-devmessages: +
2010-12-26 19:30:18 r.david.murray set priority: normal -> lowdependencies: + assertRaises as a context manager should accept a 'msg' keyword argument.versions: + Python 3.3, - Python 2.6, Python 3.1nosy: + r.david.murraymessages: + stage: test needed -> needs patch
2009-05-16 21:39:35 ajaksu2 set nosy: + ajaksu2versions: + Python 3.1, - Python 3.0
2009-05-15 01:39:18 ezio.melotti set nosy: + ezio.melottimessages: +
2009-02-12 17:53:49 ajaksu2 set nosy: + orsenthilstage: test neededcomponents: + Tests, - Library (Lib)versions: + Python 3.0
2008-08-18 17:50:17 pitrou set messages: +
2008-08-18 17:19:17 brett.cannon set messages: +
2008-08-18 10:52:23 pitrou set nosy: + pitroumessages: +
2008-08-17 21:21:01 brett.cannon create