class documentation

class TestRealSystem(_RealSystem): (source)

Implements interfaces: twisted.pair.tuntap._IInputOutputSystem

View In Hierarchy

Add extra skipping logic so tests that try to create real tunnel devices on platforms where those are not supported automatically get skipped.

Method ioctl Attempt an ioctl, but translate permission denied errors into SkipTest so that tests that require elevated system privileges and do not have them are skipped instead of failed.
Method open Attempt an open, but if the file is /dev/net/tun and it does not exist, translate the error into SkipTest so that tests that require platform support for tuntap devices are skipped instead of failed.
Method receiveUDP Use the platform network stack to receive a datagram sent to the given address.
Method sendUDP Use the platform network stack to send a datagram to the given address.

Inherited from _RealSystem:

Constant O_CLOEXEC Undocumented
Class Variable close Undocumented
Class Variable read Undocumented
Class Variable write Undocumented
def ioctl(self, *args, **kwargs): (source)

Attempt an ioctl, but translate permission denied errors into SkipTest so that tests that require elevated system privileges and do not have them are skipped instead of failed.

def open(self, filename, *args, **kwargs): (source)

Attempt an open, but if the file is /dev/net/tun and it does not exist, translate the error into SkipTest so that tests that require platform support for tuntap devices are skipped instead of failed.

def receiveUDP(self, fileno, host, port): (source)

Use the platform network stack to receive a datagram sent to the given address.

Parameters
fileno:intThe file descriptor of the tunnel used to send the datagram. This is ignored because a real socket is used to receive the datagram.
host:bytesThe IPv4 address at which the datagram will be received.
port:intThe UDP port number at which the datagram will be received.
Returns
A socket.socket which can be used to receive the specified datagram.
def sendUDP(self, datagram, address): (source)

Use the platform network stack to send a datagram to the given address.

Parameters
datagram:bytesA UDP datagram payload to send.
address:tuple of (bytes, int)The destination to which to send the datagram.
Returns
tuple of (bytes, int)The address from which the UDP datagram was sent.