Skip to content

transient_internet() (test_support): use socket.setdefaulttimeout() and test_robotparser failure #52820

Closed

Description

@vstinner
BPO 8574
Nosy @pitrou, @vstinner
Files
  • test_robotparser_transient_internet.patch
  • transient_internet-3.patch
  • 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 2010-09-07.21:40:32.094>
    created_at = <Date 2010-04-29.23:43:54.030>
    labels = []
    title = 'transient_internet() (test_support): use socket.setdefaulttimeout() and test_robotparser failure'
    updated_at = <Date 2010-09-07.21:40:32.093>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2010-09-07.21:40:32.093>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-09-07.21:40:32.094>
    closer = 'pitrou'
    components = []
    creation = <Date 2010-04-29.23:43:54.030>
    creator = 'vstinner'
    dependencies = []
    files = ['17135', '17137']
    hgrepos = []
    issue_num = 8574
    keywords = ['patch']
    message_count = 5.0
    messages = ['104596', '104597', '104599', '104600', '115807']
    nosy_count = 2.0
    nosy_names = ['pitrou', 'vstinner']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue8574'
    versions = ['Python 3.1', 'Python 2.7', 'Python 3.2']

    Activity

    1. vstinner commented on Apr 29, 2010

      @vstinner
      MemberAuthor

      Many tests of the Python test suite depends on the availability of websites, especially www.python.org. Python.org has some troubles since some days, and many buildbots failed (test_robotparser failure).

      I propose to use a default timeout of 60 seconds in transient_internet(), and then use transient_internet() in tests using the internet.

      Patches:

      • transient_internet.py: set temporary the defalt socket timeout to 60 seconds (and then restore the previous default value), and catch also weird IOError (which contain in socket.error as the 2nd argument) from urllib
      • test_robotparser_transient_internet.py: use "with transient_internet():" to do not hung anymore (for 1800 seconds!) if a website is down

      On Linux, you can use "iptables -I OUTPUT -p tcp --dport 80 -j DROP" (drop all outgoing packets) to simulate a network failure, and set the default timeout value of transient_internet() to 3 seconds.

    2. vstinner commented on Apr 29, 2010

      @vstinner
      MemberAuthor

      Oops, transient_internet.patch doesn't catch socket.error(errno.ETIMEDOUT, ...). Fixed by patch version 2.

    3. vstinner commented on Apr 30, 2010

      @vstinner
      MemberAuthor

      See also issue bpo-8499.

    4. vstinner commented on Apr 30, 2010

      @vstinner
      MemberAuthor

      Version 3 to prepare a patch for bpo-8499: don't change socket default timeout if the timeout argument is None.

    5. pitrou commented on Sep 7, 2010

      @pitrou
      Member

      Improved again and committed in r84597 and r84599. Needs backporting.

    6. 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

      No labels
      No labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions