Tests for implementations of IReactorTCP
and the TCP parts of IReactorSocket
.
Function | getLinkLocalIPv6Address | Find and return a configured link local IPv6 address including a scope
identifier using the % separation syntax. If the system has no link local
IPv6 addresses, raise SkipTest instead. |
Function | connect | Connect a socket to the given destination. |
Class | FakeSocket | A fake for socket.socket
objects. |
Class | FakeSocketTests | Test that the FakeSocket can be used by the doRead method of Connection |
Class | FakeProtocol | An IProtocol
that returns a value from its dataReceived method. |
Class | TCPServerTests | Whitebox tests for twisted.internet.tcp.Server . |
Class | TCPConnectionTests | Whitebox tests for twisted.internet.tcp.Connection . |
Class | TCPCreator | Create IPv4 TCP endpoints for runProtocolsWithReactor -based
tests. |
Class | TCP6Creator | Create IPv6 TCP endpoints for
ReactorBuilder.runProtocolsWithReactor -based tests. |
Class | FakeResolver | A resolver implementation based on a dict mapping names to
addresses. |
Class | TCPClientTestsBase | No summary |
Class | TCP4ClientTestsBuilder | Builder configured with IPv4 parameters for tests related to IReactorTCP.connectTCP . |
Class | TCP6ClientTestsBuilder | Builder configured with IPv6 parameters for tests related to IReactorTCP.connectTCP . |
Class | TCPConnectorTestsBuilder | Tests for the IConnector
provider returned by IReactorTCP.connectTCP . |
Class | TCP4ConnectorTestsBuilder | Undocumented |
Class | TCP6ConnectorTestsBuilder | Undocumented |
Function | createTestSocket | Create a socket for the duration of the given test. |
Class | ExhaustsFileDescriptorsTests | Tests for _ExhaustsFileDescriptors . |
Function | assertPeerClosedOnEMFILE | Assert that an IListeningPort
immediately closes an accepted peer socket when the number of open file
descriptors exceeds the soft resource limit. |
Class | AssertPeerClosedOnEMFILETests | Tests for assertPeerClosedOnEMFILE . |
Class | StreamTransportTestsMixin | Mixin defining tests which apply to any port/connection based transport. |
Class | ConnectToTCPListenerMixin | Provides connectToListener
for TCP transports. |
Class | ListenTCPMixin | Mixin which uses IReactorTCP.listenTCP
to hand out listening TCP ports. |
Class | SocketTCPMixin | Mixin which uses IReactorSocket.adoptStreamPort
to hand out listening TCP ports. |
Class | TCPPortTestsMixin | Tests for IReactorTCP.listenTCP |
Class | TCPPortTestsBuilder | Undocumented |
Class | TCPFDPortTestsBuilder | Undocumented |
Class | StopStartReadingProtocol | Protocol that pauses and resumes the transport a few times |
Function | oneTransportTest | No summary |
Function | assertReading | Use the given test to assert that the given transport is actively reading in the given reactor. |
Function | assertNotReading | Use the given test to assert that the given transport is not actively reading in the given reactor. |
Class | TCPConnectionTestsBuilder | Builder defining tests relating to twisted.internet.tcp.Connection . |
Class | WriteSequenceTestsMixin | Test for twisted.internet.abstract.FileDescriptor.writeSequence . |
Class | TCPTransportServerAddressTestMixin | Test mixing for TCP server address building and log prefix. |
Class | TCPTransportTestsBuilder | Test standard ITCPTransport s
built with listenTCP and connectTCP . |
Class | AdoptStreamConnectionTestsBuilder | Test server transports built using
adoptStreamConnection . |
Class | ServerAbortsTwice | Call abortConnection() twice. |
Class | ServerAbortsThenLoses | Call abortConnection() followed by loseConnection(). |
Class | AbortServerWritingProtocol | Protocol that writes data upon connection. |
Class | ReadAbortServerProtocol | Server that should never receive any data, except 'X's which are written by the other side of the connection before abortConnection, and so might possibly arrive. |
Class | NoReadServer | Stop reading immediately on connection. |
Class | EventualNoReadServer | Like NoReadServer, except we Wait until some bytes have been delivered before stopping reading. This means TLS handshake has finished, where applicable. |
Class | BaseAbortingClient | Base class for abort-testing clients. |
Class | WritingButNotAbortingClient | Write data, but don't abort. |
Class | AbortingClient | Call abortConnection() after writing some data. |
Class | AbortingTwiceClient | Call abortConnection() twice, after writing some data. |
Class | AbortingThenLosingClient | Call abortConnection() and then loseConnection(). |
Class | ProducerAbortingClient | Call abortConnection from doWrite, via resumeProducing. |
Class | StreamingProducerClient | Call abortConnection() when the other side has stopped reading. |
Class | StreamingProducerClientLater | Call abortConnection() from dataReceived, after bytes have been exchanged. |
Class | ProducerAbortingClientLater | Call abortConnection from doWrite, via resumeProducing. |
Class | DataReceivedRaisingClient | Call abortConnection(), and then throw exception, from dataReceived. |
Class | ResumeThrowsClient | Call abortConnection() and throw exception from resumeProducing(). |
Class | AbortConnectionMixin | Unit tests for ITransport.abortConnection . |
Class | AbortConnectionTests | TCP-specific AbortConnectionMixin
tests. |
Class | SimpleUtilityTests | Simple, direct tests for helpers within twisted.internet.tcp . |
Class | BuffersLogsTests | Tests for _BuffersLogs . |
Class | FileDescriptorReservationTests | Tests for _FileDescriptorReservation . |
Class | NullFileDescriptorReservationTests | Tests for _NullFileDescriptorReservation . |
Class | _FakeFDSetReactor | An in-memory implementation of IReactorFDSet ,
which records the current sets of active IReadDescriptor
and IWriteDescriptor s. |
Interface | _IExhaustsFileDescriptors | A way to trigger EMFILE . |
Class | _ExhaustsFileDescriptors | A class that triggers EMFILE by creating as many file
descriptors as necessary. |
Find and return a configured link local IPv6 address including a scope
identifier using the % separation syntax. If the system has no link local
IPv6 addresses, raise SkipTest
instead.
Returns | a str giving the address | |
Raises | SkipTest | if no link local address can be found or if the netifaces
module is not available. |
Connect a socket to the given destination.
Parameters | client | A socket.socket . |
destination | A tuple of (host, port). The host is a str , the port a
int . If the host is an IPv6 IP, the address is
resolved using getaddrinfo and the first version found is
used. |
Create a socket for the duration of the given test.
Parameters | test | the test to add cleanup to. |
addressFamily | an AF_* constant | |
socketType | a SOCK_* constant. | |
Returns | a socket object. |
Assert that an IListeningPort
immediately closes an accepted peer socket when the number of open file
descriptors exceeds the soft resource limit.
Parameters | testCase | The test case under which to run this assertion. (type: trial.unittest.SynchronousTestCase ) |
exhauster | The file descriptor exhauster. (type: _ExhaustsFileDescriptors ) | |
reactor | The reactor under test. | |
runReactor | A callable that will synchronously run the provided reactor. | |
listen | A callback to bind to a port. (type: A callable
that accepts two arguments: the provided reactor ; and a ServerFactory .
It must return an IListeningPort
provider.) | |
connect | A callback to connect a client to the listening port. (type: A callable
that accepts three arguments: the provided reactor ; the
address returned by IListeningPort.getHost ;
and a ClientFactory .
Its return value is ignored.) |
Decorate a ReactorBuilder
test function which tests one reactor and one connected transport. Run
that test method in the context of connectionMade
, and
immediately drop the connection (and end the test) when that completes.
Parameters | testMethod | A unit test method on a ReactorBuilder
test suite; taking two additional parameters; a reactor as
built by the ReactorBuilder ,
and an ITCPTransport
provider. (type: 3-argument function ) |
Returns | a no-argument test method. (type: 1-argument function ) |
Use the given test to assert that the given transport is actively reading in the given reactor.
Parameters | testCase | a test case to perform the assertion upon. (type: TestCase ) |
reactor | A reactor, possibly one providing IReactorFDSet ,
or an IOCP reactor. | |
transport | An ITCPTransport | |
Note | Maintainers; for more information on why this is a function rather than a method on a test case, see this document on how we structure test tools |
Use the given test to assert that the given transport is not actively reading in the given reactor.
Parameters | testCase | a test case to perform the assertion upon. (type: TestCase ) |
reactor | A reactor, possibly one providing IReactorFDSet ,
or an IOCP reactor. | |
transport | An ITCPTransport | |
Note | Maintainers; for more information on why this is a function rather than a method on a test case, see this document on how we structure test tools |