def test_downloadTimeoutsWorkWithoutReading(self):
"""
If the timeout indicated by the C{timeout} parameter to
L{client.HTTPDownloader.__init__} elapses without the complete response
being received, the L{defer.Deferred} returned by
L{client.downloadPage} fires with a L{Failure} wrapping a
L{defer.TimeoutError}, even if the remote peer isn't reading data from
the socket.
"""
self.cleanupServerConnections = 1
# The timeout here needs to be slightly longer to give the resource a
# change to stop the reading.
d = client.downloadPage(
self.getURL("never-read"),
self.mktemp(), timeout=0.05)
return self.assertFailure(d, defer.TimeoutError)
评论列表
文章目录