twisted.internet.test.test_fdset.ReactorFDSetTestsBuilder(ReactorBuilder)
class documentationtwisted.internet.test.test_fdset
(View In Hierarchy)
Builder defining tests relating to IReactorFDSet
.
Method | test_addReader | reactor.addReader() accepts an IReadDescriptor
provider and calls its doRead method when there may be data
available on its fileno . |
Method | test_removeReader | reactor.removeReader() accepts an IReadDescriptor
provider previously passed to reactor.addReader() and causes
it to no longer be monitored for input events. |
Method | test_addWriter | reactor.addWriter() accepts an IWriteDescriptor
provider and calls its doWrite method when it may be possible
to write to its fileno . |
Method | test_getReaders | IReactorFDSet.getReaders
reflects the additions and removals made with IReactorFDSet.addReader
and IReactorFDSet.removeReader . |
Method | test_removeWriter | reactor.removeWriter() accepts an IWriteDescriptor
provider previously passed to reactor.addWriter() and causes
it to no longer be monitored for outputability. |
Method | test_getWriters | IReactorFDSet.getWriters
reflects the additions and removals made with IReactorFDSet.addWriter
and IReactorFDSet.removeWriter . |
Method | test_removeAll | reactor.removeAll() removes all registered IReadDescriptor
providers and all registered IWriteDescriptor
providers and returns them. |
Method | test_removedFromReactor | A descriptor's fileno method should not be called after the
descriptor has been removed from the reactor. |
Method | test_negativeOneFileDescriptor | If FileDescriptor.fileno
returns -1 , the descriptor is removed from the reactor. |
Method | test_lostFileDescriptor | No summary |
Method | test_connectionLostOnShutdown | Any file descriptors added to the reactor have their
connectionLost called when reactor.stop is
called. |
Method | _connectedPair | Return the two sockets which make up a new TCP connection. |
Method | _simpleSetup | Undocumented |
Method | _getFDTest | Helper for getReaders and getWriters tests. |
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. |
reactor.addReader()
accepts an IReadDescriptor
provider and calls its doRead
method when there may be data
available on its fileno
.
reactor.removeReader()
accepts an IReadDescriptor
provider previously passed to reactor.addReader()
and causes
it to no longer be monitored for input events.
reactor.addWriter()
accepts an IWriteDescriptor
provider and calls its doWrite
method when it may be possible
to write to its fileno
.
IReactorFDSet.getReaders
reflects the additions and removals made with IReactorFDSet.addReader
and IReactorFDSet.removeReader
.
reactor.removeWriter()
accepts an IWriteDescriptor
provider previously passed to reactor.addWriter()
and causes
it to no longer be monitored for outputability.
IReactorFDSet.getWriters
reflects the additions and removals made with IReactorFDSet.addWriter
and IReactorFDSet.removeWriter
.
reactor.removeAll()
removes all registered IReadDescriptor
providers and all registered IWriteDescriptor
providers and returns them.
A descriptor's fileno
method should not be called after the
descriptor has been removed from the reactor.
If FileDescriptor.fileno
returns -1
, the descriptor is removed from the reactor.
The file descriptor underlying a FileDescriptor may be closed and replaced by another at some point. Bytes which arrive on the new descriptor must not be delivered to the FileDescriptor which was originally registered with the original descriptor of the same number.
Practically speaking, this is difficult or impossible to detect. The
implementation relies on fileno
raising an exception if the
original descriptor has gone away. If fileno
continues to
return the original file descriptor value, the reactor may deliver events
from that descriptor. This is a best effort attempt to ease certain
debugging situations. Applications should not rely on it
intentionally.