[issue8460] Set a timeout in test_urllib2net

STINNER Victor report at bugs.python.org
Tue Apr 20 01:23:06 CEST 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

> The last line references, buf. It wont be available if a
> socket.timeout had happened. So, it can simply be moved to 
> the line below buf = f.read(). Attaching the patch with 
> these changes.

Good catch :-)

> Question: Were you able to simulate a timeout at kernel.org 
> site to test this? If yes, how?

I used a firewall rule. On Linux, you can try: iptables -I OUTPUT DROP to drop all output packets (and then iptables -F to remove all rules). It's not reliable, but the test does sometimes fail :-)

----------

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


More information about the Python-bugs-list mailing list