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
transient_internet() (test_support): use socket.setdefaulttimeout() and test_robotparser failure #52820
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=<Date2010-09-07.21:40:32.094>created_at=<Date2010-04-29.23:43:54.030>labels= []
title='transient_internet() (test_support): use socket.setdefaulttimeout() and test_robotparser failure'updated_at=<Date2010-09-07.21:40:32.093>user='https://github.com/vstinner'
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.
Activity
vstinner commentedon Apr 29, 2010
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:
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.
vstinner commentedon Apr 29, 2010
Oops, transient_internet.patch doesn't catch socket.error(errno.ETIMEDOUT, ...). Fixed by patch version 2.
vstinner commentedon Apr 30, 2010
See also issue bpo-8499.
vstinner commentedon Apr 30, 2010
Version 3 to prepare a patch for bpo-8499: don't change socket default timeout if the timeout argument is None.
pitrou commentedon Sep 7, 2010
Improved again and committed in r84597 and r84599. Needs backporting.