class UNIXTestsBuilder(UNIXFamilyMixin, ReactorBuilder, ConnectionTestsMixin): (source)
Builder defining tests relating to IReactorUNIX
.
Method | test |
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_avoid |
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_connect |
IReactorUNIX.connectUNIX also accepts a Linux abstract namespace path. |
Method | test_descriptor |
IUNIXTransport.sendFileDescriptor sends file descriptors before ITransport.write sends normal bytes. |
Method | test_file |
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 ... |
Method | test_listen |
IReactorUNIX.listenUNIX raises CannotListenError if the underlying port's createInternetSocket raises a socket error. |
Method | test_listen |
On Linux, a UNIX socket path may begin with '' to indicate a socket in the abstract namespace. IReactorUNIX.listenUNIX accepts such a path. |
Method | test |
The UNIX socket created by IReactorUNIX.listenUNIX is created with the mode specified. |
Method | test_multi |
_SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived once per received file descriptor. Scenario: unsupported CMSGs. |
Method | test_multi |
_SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived once per received file descriptor. Scenario: single CMSG with two FDs. |
Method | test_multi |
_SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived once per received file descriptor. Scenario: two CMSGs with one FD each. |
Method | test_send |
IUNIXTransport.sendFileDescriptor accepts an integer file descriptor and sends a copy of it to the process reading from the connection. |
Method | test_send |
If a IUNIXTransport.sendFileDescriptor call fills up the send buffer, any registered producer is paused. |
Class Variable | endpoints |
Undocumented |
Class Variable | required |
Undocumented |
Method | _sendmsg |
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 | _mode |
Assert that the mode of the created unix socket is set to the mode specified to the reactor method. |
Inherited from ReactorBuilder
(via UNIXFamilyMixin
):
Class Method | make |
Create a SynchronousTestCase subclass which mixes in cls for each known reactor and return a dict mapping their names to them. |
Method | build |
Create and return a reactor using self.reactorFactory. |
Method | get |
Determine how long to run the test before considering it failed. |
Method | run |
Run the reactor for at most the given amount of time. |
Method | set |
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 | tear |
Restore the original SIGCHLD handler and reap processes as long as there seem to be any remaining. |
Method | unbuild |
Clean up any resources which may have been allocated for the given reactor by its creation or by a test which used it. |
Class Variable | skipped |
A dict mapping FQPN strings of reactors for which the tests defined by this class will be skipped to strings giving the skip message. |
Instance Variable | original |
The SIGCHLD handler which was installed when setUp ran and which will be re-installed when tearDown runs. |
Instance Variable | reactor |
A no-argument callable which returns the reactor to use for testing. |
Instance Variable | _reactors |
A list of FQPN strings giving the reactors for which SynchronousTestCase s will be created. |
Inherited from ConnectionTestsMixin
(via UNIXFamilyMixin
, ReactorBuilder
):
Method | test_log |
Client and server transports implement ILoggingContext.logPrefix to return a message reflecting the protocol they are running. |
Method | test_protocol |
After the connection a protocol is being used for is closed, the reactor discards all of its references to the protocol. |
Method | test_write |
After a connection is disconnected, ITransport.write and ITransport.writeSequence are no-ops. |
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.
If associated with a protocol which does not provide IFileDescriptorReceiver
, file descriptors received by the IUNIXTransport
implementation are closed and a warning is emitted.
def test_connectToLinuxAbstractNamespace(self): (source) ¶
IReactorUNIX.connectUNIX
also accepts a Linux abstract namespace path.
IUNIXTransport.sendFileDescriptor
sends file descriptors before ITransport.write
sends normal bytes.
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
.
IReactorUNIX.listenUNIX
raises CannotListenError
if the underlying port's createInternetSocket raises a socket error.
def test_listenOnLinuxAbstractNamespace(self): (source) ¶
On Linux, a UNIX socket path may begin with '' to indicate a socket in the abstract namespace. IReactorUNIX.listenUNIX
accepts such a path.
def test_multiFileDescriptorReceivedPerRecvmsgBadCMSG(self): (source) ¶
_SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived
once per received file descriptor. Scenario: unsupported CMSGs.
def test_multiFileDescriptorReceivedPerRecvmsgOneCMSG(self): (source) ¶
_SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived
once per received file descriptor. Scenario: single CMSG with two FDs.
@skipIf(
def test_multiFileDescriptorReceivedPerRecvmsgTwoCMSGs(self): (source) ¶
_SendmsgMixin handles multiple file descriptors per recvmsg, calling IFileDescriptorReceiver.fileDescriptorReceived
once per received file descriptor. Scenario: two CMSGs with one FD each.
IUNIXTransport.sendFileDescriptor
accepts an integer file descriptor and sends a copy of it to the process reading from the connection.
def test_sendFileDescriptorTriggersPauseProducing(self): (source) ¶
If a IUNIXTransport.sendFileDescriptor
call fills up the send buffer, any registered producer is paused.
Drive _SendmsgMixin via sendmsg socket calls to check that IFileDescriptorReceiver.fileDescriptorReceived
is called once for each file descriptor received in the ancillary messages.
Parameters | |
ancillary | 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. |