Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_urllib2_localnet fails #61764

Closed
markshannon opened this issue Mar 27, 2013 · 12 comments
Closed

test_urllib2_localnet fails #61764

markshannon opened this issue Mar 27, 2013 · 12 comments
Assignees
Labels
easy tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@markshannon
Copy link
Member

BPO 17564
Nosy @orsenthil, @ezio-melotti, @bitdancer, @markshannon
Files
  • issue17564.diff
  • 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 = 'https://github.com/ezio-melotti'
    closed_at = <Date 2013-03-29.23:34:20.386>
    created_at = <Date 2013-03-27.21:46:34.482>
    labels = ['easy', 'type-bug', 'tests']
    title = 'test_urllib2_localnet fails'
    updated_at = <Date 2013-03-29.23:34:20.385>
    user = 'https://github.com/markshannon'

    bugs.python.org fields:

    activity = <Date 2013-03-29.23:34:20.385>
    actor = 'ezio.melotti'
    assignee = 'ezio.melotti'
    closed = True
    closed_date = <Date 2013-03-29.23:34:20.386>
    closer = 'ezio.melotti'
    components = ['Tests']
    creation = <Date 2013-03-27.21:46:34.482>
    creator = 'Mark.Shannon'
    dependencies = []
    files = ['29604']
    hgrepos = []
    issue_num = 17564
    keywords = ['patch', 'easy']
    message_count = 12.0
    messages = ['185379', '185380', '185381', '185382', '185383', '185385', '185403', '185467', '185514', '185524', '185525', '185526']
    nosy_count = 5.0
    nosy_names = ['orsenthil', 'ezio.melotti', 'r.david.murray', 'Mark.Shannon', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue17564'
    versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']

    @markshannon
    Copy link
    Member Author

    The test_urllib2_localnet test fails when run with a clean build from a clean checkout.

    Machine:
    Ubuntu 12.04 LTS, 64 bit
    Intel i3-2370M CPU @ 2.40GHz × 4

    Test output:

    $ ./python -m test -v test_urllib2_localnet
    == CPython 3.4.0a0 (default:53cc3dbb1918, Mar 27 2013, 21:05:11) [GCC 4.6.3]
    ==   Linux-3.2.0-29-generic-x86_64-with-debian-wheezy-sid little-endian
    ==   /home/mark/repositories/cpython/build/test_python_4588
    Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1)
    [1/1] test_urllib2_localnet
    test_proxy_qop_auth_int_works_or_throws_urlerror (test.test_urllib2_localnet.ProxyAuthTests) ... ok
    test_proxy_qop_auth_works (test.test_urllib2_localnet.ProxyAuthTests) ... ok
    test_proxy_with_bad_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests) ... ok
    test_proxy_with_no_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests) ... ok
    test_200 (test.test_urllib2_localnet.TestUrlopen) ... ok
    test_200_with_parameters (test.test_urllib2_localnet.TestUrlopen) ... ok
    test_404 (test.test_urllib2_localnet.TestUrlopen) ... ok
    test_bad_address (test.test_urllib2_localnet.TestUrlopen) ... FAIL
    test_basic (test.test_urllib2_localnet.TestUrlopen) ... ok
    test_chunked (test.test_urllib2_localnet.TestUrlopen) ... ok
    test_geturl (test.test_urllib2_localnet.TestUrlopen) ... ok
    test_https (test.test_urllib2_localnet.TestUrlopen) ... stopping HTTPS server
    joining HTTPS thread
    ok
    test_https_sni (test.test_urllib2_localnet.TestUrlopen) ... stopping HTTPS server
    joining HTTPS thread
    ok
    test_https_with_cadefault (test.test_urllib2_localnet.TestUrlopen) ... stopping HTTPS server
    Got an error:
    [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:555)
    joining HTTPS thread
    ok
    test_https_with_cafile (test.test_urllib2_localnet.TestUrlopen) ... Got an error:
    [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:555)
    stopping HTTPS server
    joining HTTPS thread
    stopping HTTPS server
    joining HTTPS thread
    ok
    test_info (test.test_urllib2_localnet.TestUrlopen) ... ok
    test_iteration (test.test_urllib2_localnet.TestUrlopen) ... ok
    test_line_iteration (test.test_urllib2_localnet.TestUrlopen) ... ok
    test_redirection (test.test_urllib2_localnet.TestUrlopen) ... ok
    test_sending_headers (test.test_urllib2_localnet.TestUrlopen) ... ok

    ======================================================================
    FAIL: test_bad_address (test.test_urllib2_localnet.TestUrlopen)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/mark/repositories/cpython/Lib/test/test_urllib2_localnet.py", line 568, in test_bad_address
        "http://sadflkjsasf.i.nvali.d./")
    AssertionError: OSError not raised by urlopen

    Ran 20 tests in 1.080s

    FAILED (failures=1)
    Warning -- threading._dangling was modified by test_urllib2_localnet
    test test_urllib2_localnet failed
    1 test failed:
    test_urllib2_localnet

    @markshannon markshannon added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Mar 27, 2013
    @orsenthil
    Copy link
    Member

    Are you behind some kind of a proxy? This is seen when you are running the tests and your interent connection is via proxy (and that is handling this invalid URL test)

    @ezio-melotti
    Copy link
    Member

    There's a comment in the test that says it might be because of the ISP.
    What happens if you try to open that address in a browser or using something like wget?

    @bitdancer
    Copy link
    Member

    Indeed, this is almost always a (common) ISP DNS server misconfiguration. Well, they would claim they are "helping their users", but we know better.

    Not much we can do about it, except perhaps add an explanatory note to the test failure message (if assertRaises allows that...I think I requested that feature but I don't know if it has been added).

    @markshannon
    Copy link
    Member Author

    Bah, stupid BT :(
    I opened the URL in my browser and got a "helpful" message telling me "Sorry, the website sadflkjsasf.i.nvali.d. cannot be found"

    Perhaps we should just remove this test?
    I suspect this is only going to become more common.

    @bitdancer
    Copy link
    Member

    I think we should instead have it email the ISP that their DNS is broken :)

    Seriously, though, complain to your ISP. My ISP at least provides name servers that don't have this "feature" if you prefer to use them, and they are the default for business accounts. So they are being stupid, but less stupid than the original offender.

    If you run a local DNS forwarding server, you can configure it to ignore the wildcard records from your upstream. IMO everyone should run a local DNS caching/forwarding server for both this reason and for performance :)

    If that test is run by default, we could change it to only run with -uall. Then normal users wouldn't see it.

    Now, all that said, I won't be crushed if the test gets deleted, but I will be very very sad about what that event says about modern ISPs.

    @orsenthil
    Copy link
    Member

    RDM's comment:

    If that test is run by default, we could change it to only run with -uall. Then normal users wouldn't see it.

    This is a good idea, only to reduce the occurrence of this test_run. Logically, this may not help at all. I am kind of undecided on this. Shall we take a call that the next bug report on the same issue, will lead to moving this test under network cover ? :)

    @ezio-melotti
    Copy link
    Member

    Moving it behind -uall/-unetwork sounds good to me.

    @ezio-melotti
    Copy link
    Member

    Attached a patch to skip the test unless -unetwork/-uall is provided.

    @orsenthil
    Copy link
    Member

    LGTM - please make the changes in all versions of python.

    ( I had the same patch pending locally and was waiting for my push->merge cycle time)

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 29, 2013

    New changeset f668d2267303 by Ezio Melotti in branch '3.3':
    bpo-17564: skip test_bad_address unless the tests are run with -unetwork/-uall.
    http://hg.python.org/cpython/rev/f668d2267303

    New changeset a472fece6f31 by Ezio Melotti in branch '2.7':
    bpo-17564: skip test_bad_address unless the tests are run with -unetwork/-uall.
    http://hg.python.org/cpython/rev/a472fece6f31

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 29, 2013

    New changeset ae5c4a9118b8 by Ezio Melotti in branch 'default':
    bpo-17564: merge with 3.3.
    http://hg.python.org/cpython/rev/ae5c4a9118b8

    @ezio-melotti ezio-melotti self-assigned this Mar 29, 2013
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    easy tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants