MCPcopy Index your code
hub / github.com/python/cpython / test_fromfd

Method test_fromfd

Lib/test/test_epoll.py:142–161  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

140 ep.close()
141
142 def test_fromfd(self):
143 server, client = self._connected_pair()
144
145 with select.epoll(2) as ep:
146 ep2 = select.epoll.fromfd(ep.fileno())
147
148 ep2.register(server.fileno(), select.EPOLLIN | select.EPOLLOUT)
149 ep2.register(client.fileno(), select.EPOLLIN | select.EPOLLOUT)
150
151 events = ep.poll(1, 4)
152 events2 = ep2.poll(0.9, 4)
153 self.assertEqual(len(events), 2)
154 self.assertEqual(len(events2), 2)
155
156 try:
157 ep2.poll(1, 4)
158 except OSError as e:
159 self.assertEqual(e.args[0], errno.EBADF, e)
160 else:
161 self.fail("epoll on closed fd didn't raise EBADF")
162
163 def test_control_and_wait(self):
164 # create the epoll object

Callers

nothing calls this directly

Calls 6

_connected_pairMethod · 0.95
filenoMethod · 0.45
registerMethod · 0.45
pollMethod · 0.45
assertEqualMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected