[Python-Dev] Test failures in test_timeout
Thomas Wouters
thomas at xs4all.net
Thu Feb 16 18:43:26 CET 2006
I'm seeing spurious test failures in test_timeout, on my own workstation and
on macteagle.python.org (now that it crashes less; Apple sent over some new
memory.) The problem is pretty simple: both macteagle and my workstation
live too closely, network-wise, to www.python.org:
class TimeoutTestCase(unittest.TestCase):
[...]
def setUp(self):
[...]
self.addr_remote = ('www.python.org', 80)
[...]
def testConnectTimeout(self):
# Test connect() timeout
_timeout = 0.001
self.sock.settimeout(_timeout)
_t1 = time.time()
self.failUnlessRaises(socket.error, self.sock.connect,
self.addr_remote)
In other words, the test fails because www.python.org responds too quickly.
The test on my workstation only fails occasionally, but I do expect
macteagle's failure to be more common (since it's connected to
www.python.org through (literally) a pair of gigabit switches, whereas my
workstation has to pass through a few more switches, two Junipers and some
dark fiber.) Lowering the timeout has no effect, as far as I can tell, which
is probably a granularity issue.
I'm thinking that it could probably try to connect to a less reliable
website, but that's just moving the problem around (and possibly harassing
an unsuspecting website, particularly around release-time.) Perhaps the test
should try to connect to a known unconnecting site, like a firewalled port
on www.python.org? Not something that refuses connections, just something
that times out.
--
Thomas Wouters <thomas at xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
More information about the Python-Dev
mailing list