Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(125785)

Unified Diff: Lib/test/test_epoll.py

Issue 18794: select.devpoll objects have no close() method
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
--- a/Lib/test/test_epoll.py Wed Aug 21 13:26:34 2013 +0200
+++ b/Lib/test/test_epoll.py Wed Aug 21 20:19:00 2013 +0200
@@ -225,6 +225,32 @@ class TestEPoll(unittest.TestCase):
server.close()
ep.unregister(fd)
+ def test_close(self):
+ open_file = open(__file__, "rb")
+ self.addCleanup(open_file.close)
+ fd = open_file.fileno()
+ obj = select.epoll()
+
+ # test fileno() method and closed attribute
+ fd = obj.fileno()
Charles-Fran├žois Natali 2013/08/21 20:42:15 You're redefining 'fd' defined above: this shouldn
+ self.assertIsInstance(fd, int)
+ self.assertFalse(obj.closed)
+
+ # test close()
+ obj.close()
+ self.assertTrue(obj.closed)
+ self.assertRaises(ValueError, obj.fileno)
+
+ # close() can be called more than once
+ obj.close()
+
+ # operations must fail with ValueError("I/O operation on closed ...")
+ self.assertRaises(ValueError, obj.modify, fd, select.EPOLLIN)
+ self.assertRaises(ValueError, obj.poll, 1.0)
+ self.assertRaises(ValueError, obj.register, fd, select.EPOLLIN)
+ self.assertRaises(ValueError, obj.unregister, fd)
+
+
def test_main():
support.run_unittest(TestEPoll)

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+