Skip to content

test_urllibnet.test_bad_address() fails when using OpenDNS #47833

Closed

Description

@brettcannon
BPO 3583
Nosy @brettcannon, @orsenthil, @pitrou, @devdanzin, @ezio-melotti, @bitdancer
Dependencies
  • 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 = None
    closed_at = <Date 2013-01-11.16:18:15.354>
    created_at = <Date 2008-08-17.21:21:01.098>
    labels = ['type-bug', 'tests']
    title = 'test_urllibnet.test_bad_address() fails when using OpenDNS'
    updated_at = <Date 2013-01-11.16:18:15.353>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2013-01-11.16:18:15.353>
    actor = 'brett.cannon'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-01-11.16:18:15.354>
    closer = 'brett.cannon'
    components = ['Tests']
    creation = <Date 2008-08-17.21:21:01.098>
    creator = 'brett.cannon'
    dependencies = ['10775']
    files = []
    hgrepos = []
    issue_num = 3583
    keywords = []
    message_count = 7.0
    messages = ['71292', '71319', '71352', '71353', '87786', '124676', '179693']
    nosy_count = 7.0
    nosy_names = ['brett.cannon', 'orsenthil', 'pitrou', 'ajaksu2', 'ezio.melotti', 'r.david.murray', 'python-dev']
    pr_nums = []
    priority = 'low'
    resolution = 'fixed'
    stage = 'needs patch'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue3583'
    versions = ['Python 3.3']

    Activity

    1. brettcannon commented on Aug 17, 2008

      @brettcannon
      MemberAuthor

      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.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Aug 17, 2008
    3. pitrou commented on Aug 18, 2008

      @pitrou
      Member

      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.

    4. brettcannon commented on Aug 18, 2008

      @brettcannon
      MemberAuthor

      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?

    5. pitrou commented on Aug 18, 2008

      @pitrou
      Member

      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.

    6. added
      testsTests in the Lib/test dir
      and removed
      stdlibStandard Library Python modules in the Lib/ directory
      on Feb 12, 2009
    7. ezio-melotti commented on May 15, 2009

      @ezio-melotti
      Member

      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 bpo-6027).

    8. bitdancer commented on Dec 26, 2010

      @bitdancer
      Member

      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.

    9. python-dev commented on Jan 11, 2013

      python-devmannequin
      Mannequin

      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

    10. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions