Implements interfaces: twisted.internet.interfaces.IProcessTransport

A fake IProcessTransport provider to be used in tests.

Method __init__ Undocumented
Method writeToChild Similar to ITransport.write but also allows the file descriptor in the child process which will receive the bytes to be specified.
Method closeStdin Close stdin after all data has been written out.
Method closeStdout Close stdout.
Method closeStderr Close stderr.
Method closeChildFD Close a file descriptor which is connected to the child process, identified by its FD in the child process.
Method signalProcess Send a signal to the process.

Inherited from StringTransportWithDisconnection:

Method loseConnection Close the connection. Does nothing besides toggle the disconnecting instance variable to True.

Inherited from StringTransport (via StringTransportWithDisconnection):

Instance Variable disconnecting A bool which is False until loseConnection is called, then True.
Instance Variable disconnected A bool which is False until abortConnection is called, then True.
Instance Variable producer If a producer is currently registered, producer is a reference to it. Otherwise, None.
Instance Variable streaming If a producer is currently registered, streaming refers to the value of the second parameter passed to registerProducer.
Instance Variable hostAddr None or an object which will be returned as the host address of this transport. If None, a nasty tuple will be returned instead.
Instance Variable peerAddr None or an object which will be returned as the peer address of this transport. If None, a nasty tuple will be returned instead.
Instance Variable producerState The state of this StringTransport in its capacity as an IPushProducer. One of 'producing', 'paused', or 'stopped'.
Instance Variable io A io.BytesIO which holds the data which has been written to this transport since the last call to clear. Use value instead of accessing this directly.
Method clear Discard all data written to this transport so far.
Method value Retrieve all data which has been buffered by this transport.
Method write Write some data to the physical connection, in sequence, in a non-blocking fashion.
Method writeSequence Write an iterable of byte strings to the physical connection.
Method abortConnection Abort the connection. Same as loseConnection, but also toggles the aborted instance variable to True.
Method getPeer Get the remote address of this connection.
Method getHost Similar to getPeer, but returns an address describing this side of the connection.
Method registerProducer Register to receive data from a producer.
Method unregisterProducer Stop consuming data from a producer, without disconnecting.
Method pauseProducing Pause producing data.
Method stopProducing Stop producing data.
Method resumeProducing Resume producing data.
Instance Variable _lenient By default StringTransport enforces that resumeProducing is not called after the connection is lost. This is to ensure that any code that does call resumeProducing after the connection is lost is not blindly expecting resumeProducing to have any impact.

However, if your test case is calling resumeProducing after connection close on purpose, and you know it won't block expecting further data to show up, this flag may safely be set to True.

Defaults to False.

Method _checkState Undocumented
def __init__(self, protocol=None):
def writeToChild(self, childFD, data):

Similar to ITransport.write but also allows the file descriptor in the child process which will receive the bytes to be specified.

ParameterschildFDThe file descriptor to which to write. (type: int)
dataThe bytes to write. (type: bytes)
ReturnsNone
RaisesKeyErrorIf childFD is not a file descriptor that was mapped in the child when IReactorProcess.spawnProcess was used to create it.
def closeStdin(self):

Close stdin after all data has been written out.

def closeStdout(self):
def closeStderr(self):
def closeChildFD(self, fd):

Close a file descriptor which is connected to the child process, identified by its FD in the child process.

def signalProcess(self, signal):

Send a signal to the process.

ParameterssignalIDcan be
  • one of "KILL", "TERM", or "INT". These will be implemented in a cross-platform manner, and so should be used if possible.
  • an integer, where it represents a POSIX signal ID.
Raisestwisted.internet.error.ProcessExitedAlreadyIf the process has already exited.
OSErrorIf the os.kill call fails with an errno different from ESRCH.
API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.