classification
Title: transient_internet() (test_support): use socket.setdefaulttimeout() and test_robotparser failure
Type: Stage: resolved
Components: Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pitrou, vstinner
Priority: normal Keywords: patch

Created on 2010-04-29 23:43 by vstinner, last changed 2010-09-07 21:40 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
test_robotparser_transient_internet.patch vstinner, 2010-04-29 23:44
transient_internet-3.patch vstinner, 2010-04-30 00:17
Messages (5)
msg104596 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-04-29 23:43
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.
msg104597 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-04-29 23:59
Oops, transient_internet.patch doesn't catch socket.error(errno.ETIMEDOUT, ...). Fixed by patch version 2.
msg104599 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-04-30 00:00
See also issue #8499.
msg104600 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-04-30 00:17
Version 3 to prepare a patch for #8499: don't change socket default timeout if the timeout argument is None.
msg115807 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-09-07 21:10
Improved again and committed in r84597 and r84599. Needs backporting.
History
Date User Action Args
2010-09-07 21:40:32pitrousetstatus: pending -> closed
2010-09-07 21:10:08pitrousetstatus: open -> pending

versions: - Python 2.6
nosy: + pitrou

messages: + msg115807
resolution: fixed
stage: resolved
2010-04-30 00:19:31vstinnerlinkissue8499 dependencies
2010-04-30 00:17:09vstinnersetfiles: - transient_internet-2.patch
2010-04-30 00:17:01vstinnersetfiles: + transient_internet-3.patch

messages: + msg104600
2010-04-30 00:00:28vstinnersetmessages: + msg104599
2010-04-29 23:59:47vstinnersetfiles: - transient_internet.patch
2010-04-29 23:59:40vstinnersetfiles: + transient_internet-2.patch

messages: + msg104597
2010-04-29 23:44:05vstinnersetfiles: + test_robotparser_transient_internet.patch
2010-04-29 23:43:54vstinnercreate