class MemoryReactor: (source)
Known subclasses: twisted.internet.testing.MemoryReactorClock
Constructor: MemoryReactor()
Implements interfaces: twisted.internet.interfaces.IReactorCore
, twisted.internet.interfaces.IReactorFDSet
, twisted.internet.interfaces.IReactorSocket
, twisted.internet.interfaces.IReactorSSL
, twisted.internet.interfaces.IReactorTCP
, twisted.internet.interfaces.IReactorUNIX
A fake reactor to be used in tests. This reactor doesn't actually do much that's useful yet. It accepts TCP connection setup attempts, but they will never succeed.
Method | __init__ |
Initialize the tracking lists. |
Method | add |
Fake IReactorFDSet.addReader which adds the reader to a local set. |
Method | add |
Fake IReactorCore.run . Keep track of trigger by appending it to self.triggers[phase][eventType]. |
Method | add |
Fake IReactorFDSet.addWriter which adds the writer to a local set. |
Method | adopt |
Fake IReactorSocket.adoptDatagramPort , that logs the call and returns a fake IListeningPort . |
Method | adopt |
Record the given stream connection in adoptedStreamConnections. |
Method | adopt |
Fake IReactorSocket.adoptStreamPort , that logs the call and returns an IListeningPort . |
Method | call |
Fake IReactorCore.callWhenRunning . Keeps a list of invocations to make in self.whenRunningHooks. |
Method | connect |
Fake IReactorSSL.connectSSL , that logs the call and returns an IConnector . |
Method | connect |
Fake IReactorTCP.connectTCP , that logs the call and returns an IConnector . |
Method | connect |
Fake IReactorUNIX.connectUNIX , that logs the call and returns an IConnector . |
Method | crash |
Fake IReactorCore.crash . Sets self.running to None , because that feels crashy. Sets self.hasCrashed to True . |
Method | fire |
Not implemented; raises NotImplementedError . |
Method | get |
Fake IReactorFDSet.getReaders which returns a list of readers from the local set. |
Method | get |
Fake IReactorFDSet.getWriters which returns a list of writers from the local set. |
Method | install |
Fake install callable to emulate reactor module installation. |
Method | iterate |
Not implemented; raises NotImplementedError . |
Method | listen |
Fake IReactorSSL.listenSSL , that logs the call and returns an IListeningPort . |
Method | listen |
Fake IReactorTCP.listenTCP , that logs the call and returns an IListeningPort . |
Method | listen |
Fake IReactorUNIX.listenUNIX , that logs the call and returns an IListeningPort . |
Method | remove |
Fake IReactorFDSet.removeAll which removed all readers and writers from the local sets. |
Method | remove |
Fake IReactorFDSet.removeReader which removes the reader from a local set. |
Method | remove |
Not implemented; raises NotImplementedError . |
Method | remove |
Fake IReactorFDSet.removeWriter which removes the writer from a local set. |
Method | resolve |
Not implemented; raises NotImplementedError . |
Method | run |
Fake IReactorCore.run . Sets self.running to True , runs all of the hooks passed to self.callWhenRunning, then calls self.stop to simulate a request to stop the reactor. Sets self.hasRun to True . |
Method | stop |
Fake IReactorCore.run . Sets self.running to False . Sets self.hasStopped to True . |
Instance Variable | adopted |
Keeps track of server listen attempts (ie, calls to adoptStreamPort). |
Instance Variable | adopted |
Keeps track of stream-oriented connections added using adoptStreamConnection. |
Instance Variable | connectors |
Undocumented |
Instance Variable | has |
Keeps track of whether this reactor has crashed. |
Instance Variable | has |
Keeps track of whether this reactor has been installed. |
Instance Variable | has |
Undocumented |
Instance Variable | has |
Keeps track of whether this reactor has been stopped. |
Instance Variable | readers |
Undocumented |
Instance Variable | running |
Keeps track of whether this reactor is running. |
Instance Variable | ssl |
Keeps track of connection attempts (ie, calls to connectSSL). |
Instance Variable | ssl |
Keeps track of server listen attempts (ie, calls to listenSSL). |
Instance Variable | tcp |
Keeps track of connection attempts (ie, calls to connectTCP). |
Instance Variable | tcp |
Keeps track of server listen attempts (ie, calls to listenTCP). |
Instance Variable | triggers |
Keeps track of hooks registered with addSystemEventTrigger. |
Instance Variable | unix |
Keeps track of connection attempts (ie, calls to connectUNIX). |
Instance Variable | unix |
Keeps track of server listen attempts (ie, calls to listenUNIX). |
Instance Variable | when |
Keeps track of hooks registered with callWhenRunning. |
Instance Variable | writers |
Undocumented |
str
, eventType: str
, callable: Callable[ _P, object]
, *args: _P.args
, **kw: _P.kwargs
):
(source)
¶
Fake IReactorCore.run
. Keep track of trigger by appending it to self.triggers[phase][eventType].
Fake IReactorSocket.adoptDatagramPort
, that logs the call and returns a fake IListeningPort
.
See Also | |
twisted.internet.interfaces.IReactorSocket.adoptDatagramPort |
Record the given stream connection in adoptedStreamConnections.
See Also | |
twisted.internet.interfaces.IReactorSocket.adoptStreamConnection |
Callable[ _P, object]
, *args: _P.args
, **kw: _P.kwargs
):
(source)
¶
Fake IReactorCore.callWhenRunning
. Keeps a list of invocations to make in self.whenRunningHooks.
Fake IReactorCore.crash
. Sets self.running to None
, because that feels crashy. Sets self.hasCrashed to True
.
Fake IReactorCore.run
. Sets self.running to True
, runs all of the hooks passed to self.callWhenRunning, then calls self.stop to simulate a request to stop the reactor. Sets self.hasRun to True
.