You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_urllibnet.test_bad_address() fails when using OpenDNS #47833
bpo-10775: assertRaises as a context manager should accept a 'msg' keyword argument.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2013-01-11.16:18:15.354>created_at=<Date2008-08-17.21:21:01.098>labels= ['type-bug', 'tests']
title='test_urllibnet.test_bad_address() fails when using OpenDNS'updated_at=<Date2013-01-11.16:18:15.353>user='https://github.com/brettcannon'
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.
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.
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?
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"
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.
Activity
brettcannon commentedon Aug 17, 2008
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.
pitrou commentedon Aug 18, 2008
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.
brettcannon commentedon Aug 18, 2008
On Mon, Aug 18, 2008 at 3:52 AM, Antoine Pitrou <report@bugs.python.org> wrote:
That's also a possibility.
Out of curiosity, what HTTP response should be received?
pitrou commentedon Aug 18, 2008
Le lundi 18 août 2008 à 17:19 +0000, Brett Cannon a écrit :
There shouldn't be an HTTP response at all. If DNS lookup fails,
connecting to the server simply fails.
ezio-melotti commentedon May 15, 2009
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"
test_xmlrpc_net failed for the same reason (see bpo-6027).
bitdancer commentedon Dec 26, 2010
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.
python-dev commentedon Jan 11, 2013
New changeset acce13a6e728 by Brett Cannon in branch 'default':
Issue bpo-3583: mention that testing whether a bad address not triggering
http://hg.python.org/cpython/rev/acce13a6e728