r46778 - failing test for timeout case
glyph-TA+aISz0psMTMxyoc4vAAJOcrHinNvQL0E9HWUfgJXw@public.gmane.org
| Newsgroups | gmane.comp.python.twisted.commits |
|---|---|
| Message-ID | <[email protected]> |
Author: glyph
Date: Fri Feb 12 03:10:35 2016
New Revision: 46778
Modified:
branches/hostname-endpoint-8014/twisted/internet/test/test_endpoints.py
Log:
failing test for timeout case
Modified: branches/hostname-endpoint-8014/twisted/internet/test/test_endpoints.py
==============================================================================
--- branches/hostname-endpoint-8014/twisted/internet/test/test_endpoints.py (original)
+++ branches/hostname-endpoint-8014/twisted/internet/test/test_endpoints.py Fri Feb 12 03:10:35 2016
@@ -1660,10 +1660,10 @@
self.assertEqual(ep._getaddrinfo, socket.getaddrinfo)
- def test_endpointConnectingCancelled(self):
+ def test_endpointConnectingCancelled(self, advance=None):
"""
Calling L{Deferred.cancel} on the L{Deferred} returned from
- L{IStreamClientEndpoint.connect} is errbacked with an expected
+ L{IStreamClientEndpoint.connect} will cause it to be errbacked with a
L{ConnectingCancelledError} exception.
"""
mreactor = MemoryReactor()
@@ -1675,6 +1675,8 @@
mreactor, clientFactory)
d = ep.connect(clientFactory)
+ if advance is not None:
+ mreactor.advance(advance)
d.cancel()
# When canceled, the connector will immediately notify its factory that
# the connection attempt has failed due to a UserError.
@@ -1689,6 +1691,16 @@
self.assertTrue(mreactor.tcpClients[0][2]._connector.stoppedConnecting)
+ def test_endpointConnectingCancelledAfterAllAttemptsStarted(self):
+ """
+ Calling L{Deferred.cancel} on the L{Deferred} returned from
+ L{IStreamClientEndpoint.connect} after enough time has passed that all
+ connection attempts have been initiated will cause it to be errbacked
+ with a L{ConnectingCancelledError} exception.
+ """
+ self.test_endpointConnectingCancelled(advance=0.31)
+
+
def test_endpointConnectFailure(self):
"""
If L{HostnameEndpoint.connect} is invoked and there is no server