twisted.internet.test.test_unix.UNIXTestsBuilder(UNIXFamilyMixin, ReactorBuilder, ConnectionTestsMixin)
class documentationtwisted.internet.test.test_unix
(View In Hierarchy)
Builder defining tests relating to IReactorUNIX
.
Method | test_mode | The UNIX socket created by IReactorUNIX.listenUNIX
is created with the mode specified. |
Method | test_listenOnLinuxAbstractNamespace | On Linux, a UNIX socket path may begin with '\x00' to indicate
a socket in the abstract namespace. IReactorUNIX.listenUNIX
accepts such a path. |
Method | test_listenFailure | IReactorUNIX.listenUNIX
raises CannotListenError
if the underlying port's createInternetSocket raises a socket error. |
Method | test_connectToLinuxAbstractNamespace | IReactorUNIX.connectUNIX
also accepts a Linux abstract namespace path. |
Method | test_addresses | A client's transport's getHost and getPeer
return UNIXAddress
instances which have the filesystem path of the host and peer ends of the
connection. |
Method | test_sendFileDescriptor | IUNIXTransport.sendFileDescriptor
accepts an integer file descriptor and sends a copy of it to the process
reading from the connection. |
Method | test_sendFileDescriptorTriggersPauseProducing | If a IUNIXTransport.sendFileDescriptor
call fills up the send buffer, any registered producer is paused. |
Method | test_fileDescriptorOverrun | No summary |
Method | test_multiFileDescriptorReceivedPerRecvmsgOneCMSG | _SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived
once per received file descriptor. Scenario: single CMSG with two FDs. |
Method | test_multiFileDescriptorReceivedPerRecvmsgTwoCMSGs | _SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived
once per received file descriptor. Scenario: two CMSGs with one FD
each. |
Method | test_multiFileDescriptorReceivedPerRecvmsgBadCMSG | _SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived
once per received file descriptor. Scenario: unsupported CMSGs. |
Method | test_avoidLeakingFileDescriptors | If associated with a protocol which does not provide IFileDescriptorReceiver ,
file descriptors received by the IUNIXTransport
implementation are closed and a warning is emitted. |
Method | test_descriptorDeliveredBeforeBytes | IUNIXTransport.sendFileDescriptor
sends file descriptors before ITransport.write
sends normal bytes. |
Method | _sendmsgMixinFileDescriptorReceivedDriver | Drive _SendmsgMixin via sendmsg socket calls to check that IFileDescriptorReceiver.fileDescriptorReceived
is called once for each file descriptor received in the ancillary
messages. |
Inherited from UNIXFamilyMixin:
Method | _modeTest | Assert that the mode of the created unix socket is set to the mode specified to the reactor method. |
Inherited from ReactorBuilder:
Class Variable | skippedReactors | A dict mapping FQPN strings of reactors for which the tests defined by this class will be skipped to strings giving the skip message. |
Class Variable | requiredInterfaces | A list of interfaces which the reactor must provide or these
tests will be skipped. The default, None ,
means that no interfaces are required. |
Instance Variable | reactorFactory | A no-argument callable which returns the reactor to use for testing. |
Instance Variable | originalHandler | The SIGCHLD handler which was installed when setUp ran and which will be re-installed when tearDown runs. |
Method | setUp | Clear the SIGCHLD handler, if there is one, to ensure an environment
like the one which exists prior to a call to reactor.run . |
Method | tearDown | Restore the original SIGCHLD handler and reap processes as long as there seem to be any remaining. |
Method | unbuildReactor | Clean up any resources which may have been allocated for the given reactor by its creation or by a test which used it. |
Method | buildReactor | Create and return a reactor using self.reactorFactory . |
Method | getTimeout | Determine how long to run the test before considering it failed. |
Method | runReactor | Run the reactor for at most the given amount of time. |
Class Method | makeTestCaseClasses | Create a SynchronousTestCase
subclass which mixes in cls for each known reactor and return
a dict mapping their names to them. |
Instance Variable | _reactors | A list of FQPN strings giving the reactors for which SynchronousTestCase s
will be created. |
Inherited from ConnectionTestsMixin:
Method | test_logPrefix | Client and server transports implement ILoggingContext.logPrefix
to return a message reflecting the protocol they are running. |
Method | test_writeAfterDisconnect | After a connection is disconnected, ITransport.write
and ITransport.writeSequence
are no-ops. |
Method | test_protocolGarbageAfterLostConnection | After the connection a protocol is being used for is closed, the reactor discards all of its references to the protocol. |
The UNIX socket created by IReactorUNIX.listenUNIX
is created with the mode specified.
On Linux, a UNIX socket path may begin with '\x00'
to indicate
a socket in the abstract namespace. IReactorUNIX.listenUNIX
accepts such a path.
IReactorUNIX.listenUNIX
raises CannotListenError
if the underlying port's createInternetSocket raises a socket error.
IReactorUNIX.connectUNIX
also accepts a Linux abstract namespace path.
A client's transport's getHost
and getPeer
return UNIXAddress
instances which have the filesystem path of the host and peer ends of the
connection.
IUNIXTransport.sendFileDescriptor
accepts an integer file descriptor and sends a copy of it to the process
reading from the connection.
If a IUNIXTransport.sendFileDescriptor
call fills up the send buffer, any registered producer is paused.
If IUNIXTransport.sendFileDescriptor
is used to queue a greater number of file descriptors than the number of
bytes sent using ITransport.write
,
the connection is closed and the protocol connected to the transport has
its connectionLost
method called with a failure wrapping FileDescriptorOverrun
.
Drive _SendmsgMixin via sendmsg socket calls to check that IFileDescriptorReceiver.fileDescriptorReceived
is called once for each file descriptor received in the ancillary
messages.
Parameters | ancillaryPacker | A callable that will be given a list of two file descriptors and should return a two-tuple where: The first item is an iterable of zero or more (cmsg_level, cmsg_type, cmsg_data) tuples in the same order as the given list for actual sending via sendmsg; the second item is an integer indicating the expected number of FDs to be received. |
_SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived
once per received file descriptor. Scenario: single CMSG with two FDs.
_SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived
once per received file descriptor. Scenario: two CMSGs with one FD
each.
_SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived
once per received file descriptor. Scenario: unsupported CMSGs.
If associated with a protocol which does not provide IFileDescriptorReceiver
,
file descriptors received by the IUNIXTransport
implementation are closed and a warning is emitted.
IUNIXTransport.sendFileDescriptor
sends file descriptors before ITransport.write
sends normal bytes.