This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: test_urllibnet.test_bad_address() fails when using OpenDNS
类型: behavior Stage: needs patch
Components: Tests Versions: Python 3.3
process
状态: closed Resolution: fixed
Dependencies: 10775 后续:
分配给: 抄送列表: ajaksu2, brett.cannon, ezio.melotti, orsenthil, pitrou, python-dev, r.david.murray
优先级: low 关键字:

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) 日期: 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) 日期: 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) 日期: 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) 日期: 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) 日期: 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) 日期: 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) 日期: 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
历史
日期 用户 动作 参数
2022-04-11 14:56:37admin修改github: 47833
2013-01-11 16:18:15brett.cannon修改状态: open -> closed
resolution: fixed
2013-01-11 16:18:00python-dev修改抄送: + python-dev
消息: + msg179693
2010-12-26 19:30:18r.david.murray修改优先级: normal -> low

dependencies: + assertRaises as a context manager should accept a 'msg' keyword argument.
versions: + Python 3.3, - Python 2.6, Python 3.1
抄送: + r.david.murray

消息: + msg124676
stage: test needed -> needs patch
2009-05-16 21:39:35ajaksu2修改抄送: + ajaksu2

versions: + Python 3.1, - Python 3.0
2009-05-15 01:39:18ezio.melotti修改抄送: + ezio.melotti
消息: + msg87786
2009-02-12 17:53:49ajaksu2修改抄送: + orsenthil
stage: test needed
components: + Tests, - Library (Lib)
versions: + Python 3.0
2008-08-18 17:50:17pitrou修改消息: + msg71353
2008-08-18 17:19:17brett.cannon修改消息: + msg71352
2008-08-18 10:52:23pitrou修改抄送: + pitrou
消息: + msg71319
2008-08-17 21:21:01brett.cannon创建