Known subclasses: twisted.internet.test.test_endpoints.HostnameEndpointMemoryIPv4ReactorTests, twisted.internet.test.test_endpoints.HostnameEndpointMemoryIPv6ReactorTests

Common methods for testing HostnameEndpoint against MemoryReactor instances that do not provide IReactorPluggableNameResolver.

Method synchronousDeferredToThread A synchronous version of deferToThread.
Method expectedClients Extract expected clients from the reactor.
Method connectArgs
Method assertConnectArgs No summary
Method test_endpointConnectFailure When HostnameEndpoint.connect cannot connect to its destination, the returned Deferred will fail with ConnectError.
Method test_deprecation Instantiating HostnameEndpoint with a reactor that does not provide IReactorPluggableResolver emits a deprecation warning.
Method test_errorsLogged Hostname resolution errors are logged.

Inherited from ClientEndpointTestCaseMixin:

Method test_interface The endpoint provides interfaces.IStreamClientEndpoint
Method retrieveConnectedFactory Retrieve a single factory that has connected using the given reactor. (This behavior is valid for TCP and SSL but needs to be overridden for UNIX.)
Method test_endpointConnectSuccess A client endpoint can connect and returns a deferred who gets called back with a protocol instance.
Method test_endpointConnectingCancelled Calling Deferred.cancel on the Deferred returned from IStreamClientEndpoint.connect is errbacked with an expected ConnectingCancelledError exception.
Method test_endpointConnectNonDefaultArgs The endpoint should pass it's connectArgs parameter to the reactor's listen methods.
def synchronousDeferredToThread(self, f, *args, **kwargs):

A synchronous version of deferToThread.

ParametersfThe callable to invoke. (type: callable)
argsPositional arguments to the callable.
kwargsKeyword arguments to the callable.
ReturnsA Deferred that fires with the result of applying f to args and kwargs or the exception raised.
def expectedClients(self, reactor):

Extract expected clients from the reactor.

ParametersreactorThe MemoryReactor under test.
ReturnsList of calls to IReactorTCP.connectTCP
def connectArgs(self):
Returnsdict of keyword arguments to pass to connect.
def assertConnectArgs(self, receivedArgs, expectedArgs):

Compare host, port, timeout, and bindAddress in receivedArgs to expectedArgs. We ignore the factory because we don't only care what protocol comes out of the IStreamClientEndpoint.connect call.

ParametersreceivedArgstuple of (host, port, factory, timeout, bindAddress) that was passed to IReactorTCP.connectTCP.
expectedArgstuple of (host, port, factory, timeout, bindAddress) that we expect to have been passed to IReactorTCP.connectTCP.
def test_endpointConnectFailure(self):

When HostnameEndpoint.connect cannot connect to its destination, the returned Deferred will fail with ConnectError.

def test_deprecation(self):

Instantiating HostnameEndpoint with a reactor that does not provide IReactorPluggableResolver emits a deprecation warning.

def test_errorsLogged(self):

Hostname resolution errors are logged.

API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.