diff options
author | R. David Murray <rdmurray@bitdance.com> | 2009-05-31 19:15:57 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2009-05-31 19:15:57 (GMT) |
commit | 8fcaebbef48f411e71e64bce32c40d8cb810fe23 (patch) | |
tree | 898f745ead46a4051c6d25bddacc45f3d440731f /Lib | |
parent | d11f7fcc0f29df39595179c577da5ff83467fa5f (diff) | |
download | cpython-8fcaebbef48f411e71e64bce32c40d8cb810fe23.zip cpython-8fcaebbef48f411e71e64bce32c40d8cb810fe23.tar.gz cpython-8fcaebbef48f411e71e64bce32c40d8cb810fe23.tar.bz2 |
Issue 3848: document the fact that epoll register raises an IOError if
an fd is registered twice, and add some additional epoll tests. Patch
by Christian Heimes.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_epoll.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/test/test_epoll.py b/Lib/test/test_epoll.py index 2362ad5..15c9869 100644 --- a/Lib/test/test_epoll.py +++ b/Lib/test/test_epoll.py @@ -95,6 +95,34 @@ class TestEPoll(unittest.TestCase): finally: ep.close() + # adding by object w/ fileno works, too. + ep = select.epoll(2) + try: + ep.register(server, select.EPOLLIN | select.EPOLLOUT) + ep.register(client, select.EPOLLIN | select.EPOLLOUT) + finally: + ep.close() + + ep = select.epoll(2) + try: + # TypeError: argument must be an int, or have a fileno() method. + self.assertRaises(TypeError, ep.register, object(), + select.EPOLLIN | select.EPOLLOUT) + self.assertRaises(TypeError, ep.register, None, + select.EPOLLIN | select.EPOLLOUT) + # ValueError: file descriptor cannot be a negative integer (-1) + self.assertRaises(ValueError, ep.register, -1, + select.EPOLLIN | select.EPOLLOUT) + # IOError: [Errno 9] Bad file descriptor + self.assertRaises(IOError, ep.register, 10000, + select.EPOLLIN | select.EPOLLOUT) + # registering twice also raises an exception + ep.register(server, select.EPOLLIN | select.EPOLLOUT) + self.assertRaises(IOError, ep.register, server, + select.EPOLLIN | select.EPOLLOUT) + finally: + ep.close() + def test_fromfd(self): server, client = self._connected_pair() |