Skip to content
Snippets Groups Projects
Commit 6ef78352 authored by Paul Sokolovsky's avatar Paul Sokolovsky Committed by Damien George
Browse files

tests/uselect_poll_basic: Add basic test for uselect.poll invariants.

This test doesn't check the actual I/O behavior, just "static" invariants
like behavior on duplicate calls or calls when I/O object is not registered
with poller.
parent b9bad7ff
No related branches found
No related tags found
No related merge requests found
try:
import usocket as socket, uselect as select, uerrno as errno
except ImportError:
try:
import socket, select, errno
except ImportError:
print("SKIP")
raise SystemExit
poller = select.poll()
s = socket.socket()
poller.register(s)
# https://docs.python.org/3/library/select.html#select.poll.register
# "Registering a file descriptor that’s already registered is not an error,
# and has the same effect as registering the descriptor exactly once."
poller.register(s)
# 2 args are mandatory unlike register()
try:
poller.modify(s)
except TypeError:
print("modify:TypeError")
poller.modify(s, select.POLLIN)
poller.unregister(s)
try:
poller.modify(s, select.POLLIN)
except OSError as e:
assert e.args[0] == errno.ENOENT
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment