pypy/module/select/test/test_epoll.py::AppTestEpoll::()::test_control_and_wait
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0xf43d644c>
def test_control_and_wait(self):
import select
import time
client, server = self.socket_pair()
ep = select.epoll(16)
ep.register(server.fileno(),
select.EPOLLIN | select.EPOLLOUT | select.EPOLLET
)
ep.register(client.fileno(),
select.EPOLLIN | select.EPOLLOUT | select.EPOLLET
)
now = time.time()
events = ep.poll(1, 4)
then = time.time()
assert then - now < 0.1
events.sort()
expected = [
(client.fileno(), select.EPOLLOUT),
(server.fileno(), select.EPOLLOUT)
]
expected.sort()
assert events == expected
assert then - now < self.timeout
now = time.time()
events = ep.poll(timeout=2.1, maxevents=4)
then = time.time()
assert not events
client.send(b"Hello!")
server.send(b"world!!!")
now = time.time()
events = ep.poll(1, 4)
then = time.time()
> assert then - now < self.timeout
E (application-level) AssertionError
[/build_dir/own-linux-x86-32/build/pypy/module/select/test/test_epoll.py:132]:41: AssertionError
builder: own-linux-x86-32 build #9408+
test: pypy/module/select/test/test_epoll.py::AppTestEpoll::()::test_control_and_wait