Issue #16488: epoll() objects now support the with statement.

Patch by Serhiy Storchaka.
This commit is contained in:
Antoine Pitrou 2012-12-15 21:14:21 +01:00
parent c48e81ed46
commit 09bb89b8cf
4 changed files with 36 additions and 1 deletions

View file

@ -87,6 +87,13 @@ class TestEPoll(unittest.TestCase):
self.assertRaises(TypeError, select.epoll, ['foo'])
self.assertRaises(TypeError, select.epoll, {})
def test_context_manager(self):
with select.epoll(16) as ep:
self.assertGreater(ep.fileno(), 0)
self.assertFalse(ep.closed)
self.assertTrue(ep.closed)
self.assertRaises(ValueError, ep.fileno)
def test_add(self):
server, client = self._connected_pair()