[issue8574] transient_internet() (test_support): use socket.setdefaulttimeout() and test_robotparser failure

STINNER Victor report at bugs.python.org
Fri Apr 30 01:43:56 CEST 2010


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

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.

----------
files: transient_internet.patch
keywords: patch
messages: 104596
nosy: haypo
priority: normal
severity: normal
status: open
title: transient_internet() (test_support): use socket.setdefaulttimeout() and test_robotparser failure
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file17134/transient_internet.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8574>
_______________________________________


More information about the Python-bugs-list mailing list