twisted.pair.test.test_tuntap.TestRealSystem(_RealSystem)
class documentationtwisted.pair.test.test_tuntap
(View In Hierarchy)
Implements interfaces: twisted.pair.tuntap._IInputOutputSystem
Add extra skipping logic so tests that try to create real tunnel devices on platforms where those are not supported automatically get skipped.
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 | 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 | sendUDP | Use the platform network stack to send a datagram to the given address. |
Method | receiveUDP | Use the platform network stack to receive a datagram sent to the given address. |
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.
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.
Use the platform network stack to send a datagram to the given address.
Parameters | datagram | A UDP datagram payload to send. (type: bytes ) |
address | The destination to which to send the datagram. (type: tuple
of (bytes ,
int )) | |
Returns | The address from which the UDP datagram was sent. (type: tuple
of (bytes ,
int )) |
Use the platform network stack to receive a datagram sent to the given address.
Parameters | fileno | The file descriptor of the tunnel used to send the datagram. This is
ignored because a real socket is used to receive the datagram. (type: int ) |
host | The IPv4 address at which the datagram will be received. (type: bytes ) | |
port | The UDP port number at which the datagram will be received. (type: int ) | |
Returns | A socket.socket
which can be used to receive the specified datagram. |