Go to the latest version of this document.

# ``twisted`.`internet`.`testing`.`RaisingMemoryReactor``

class documentation

`class RaisingMemoryReactor: (source)`

Constructor: `RaisingMemoryReactor(listenException, connectException)`

Implements interfaces: `twisted.internet.interfaces.IReactorPluggableNameResolver`, `twisted.internet.interfaces.IReactorSocket`, `twisted.internet.interfaces.IReactorSSL`, `twisted.internet.interfaces.IReactorTCP`, `twisted.internet.interfaces.IReactorUNIX`

View In Hierarchy

A fake reactor to be used in tests. It accepts TCP connection setup attempts, but they will fail.

Method | `__init__` | No summary
Method | `adoptDatagramPort` | Fake `IReactorSocket.adoptDatagramPort`, that raises `_connectException`.
Method | `adoptStreamConnection` | Fake `IReactorSocket.adoptStreamConnection`, that raises `_connectException`.
Method | `adoptStreamPort` | Fake `IReactorSocket.adoptStreamPort`, that raises `_listenException`.
Method | `connectSSL` | Fake `IReactorSSL.connectSSL`, that raises `_connectException`.
Method | `connectTCP` | Fake `IReactorTCP.connectTCP`, that raises `_connectException`.
Method | `connectUNIX` | Fake `IReactorUNIX.connectUNIX`, that raises `_connectException`.
Method | `installNameResolver` | Implement `IReactorPluggableNameResolver`.
Method | `listenSSL` | Fake `IReactorSSL.listenSSL`, that raises `_listenException`.
Method | `listenTCP` | Fake `IReactorTCP.listenTCP`, that raises `_listenException`.
Method | `listenUNIX` | Fake `IReactorUNIX.listenUNIX`, that raises `_listenException`.
Instance Variable | `nameResolver` | Read-only attribute; the resolver installed with `installResolver`. An `IHostnameResolver`.
Instance Variable | `_connectException` | An instance of an `Exception`
Instance Variable | `_listenException` | An instance of an `Exception`

def __init__(self, listenException: `Exception | None` = None, connectException: `Exception | None` = None): (source)

Parameters
listenException:`Exception | None` | An instance of an `Exception` to raise when any `listen` method is called.
connectException:`Exception | None` | An instance of an `Exception` to raise when any `connect` method is called.

def adoptDatagramPort(self, fileDescriptor, addressFamily, protocol, maxPacketSize): (source)
from `twisted.internet.interfaces.IReactorSocket`

Fake `IReactorSocket.adoptDatagramPort`, that raises `_connectException`.

def adoptStreamConnection(self, fileDescriptor, addressFamily, factory): (source)
from `twisted.internet.interfaces.IReactorSocket`

Fake `IReactorSocket.adoptStreamConnection`, that raises `_connectException`.

def adoptStreamPort(self, fileno, addressFamily, factory): (source)
from `twisted.internet.interfaces.IReactorSocket`

Fake `IReactorSocket.adoptStreamPort`, that raises `_listenException`.

def connectSSL(self, host, port, factory, contextFactory, timeout=30, bindAddress=None): (source)
from `twisted.internet.interfaces.IReactorSSL`

Fake `IReactorSSL.connectSSL`, that raises `_connectException`.

def connectTCP(self, host, port, factory, timeout=30, bindAddress=None): (source)
from `twisted.internet.interfaces.IReactorTCP`

Fake `IReactorTCP.connectTCP`, that raises `_connectException`.

def connectUNIX(self, address, factory, timeout=30, checkPID=0): (source)
from `twisted.internet.interfaces.IReactorUNIX`

Fake `IReactorUNIX.connectUNIX`, that raises `_connectException`.

def installNameResolver(self, nameResolver: `IHostnameResolver`) -> `IHostnameResolver`: (source)
from `twisted.internet.interfaces.IReactorPluggableNameResolver`

Implement `IReactorPluggableNameResolver`.

def listenSSL(self, port, factory, contextFactory, backlog=50, interface=''): (source)
from `twisted.internet.interfaces.IReactorSSL`

Fake `IReactorSSL.listenSSL`, that raises `_listenException`.

def listenTCP(self, port, factory, backlog=50, interface=''): (source)
from `twisted.internet.interfaces.IReactorTCP`

Fake `IReactorTCP.listenTCP`, that raises `_listenException`.

def listenUNIX(self, address, factory, backlog=50, mode=438, wantPID=0): (source)
from `twisted.internet.interfaces.IReactorUNIX`

Fake `IReactorUNIX.listenUNIX`, that raises `_listenException`.

nameResolver: `IHostnameResolver` = (source)
from `twisted.internet.interfaces.IReactorPluggableNameResolver`

Read-only attribute; the resolver installed with `installResolver`. An `IHostnameResolver`.

_connectException = (source)

An instance of an `Exception`

_listenException = (source)

An instance of an `Exception`