From: Victor Stinner Date: Sat, 25 Jan 2014 13:40:04 +0000 (+0100) Subject: (Merge 3.3) Issue #20311: Revert 033137c12d88 (02f9db3e684e), X-Git-Tag: v3.4.0b3~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=38c72bd1996164a6f3f90df998f0b9627b07138a;p=thirdparty%2FPython%2Fcpython.git (Merge 3.3) Issue #20311: Revert 033137c12d88 (02f9db3e684e), select.epoll.poll() rounds again the timeout towards zero --- 38c72bd1996164a6f3f90df998f0b9627b07138a diff --cc Lib/test/test_epoll.py index 58dd92f7e19f,871efb2d3143..0c88cc424cf2 --- a/Lib/test/test_epoll.py +++ b/Lib/test/test_epoll.py @@@ -225,46 -217,6 +225,35 @@@ 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() + epoll = select.epoll() + + # test fileno() method and closed attribute + self.assertIsInstance(epoll.fileno(), int) + self.assertFalse(epoll.closed) + + # test close() + epoll.close() + self.assertTrue(epoll.closed) + self.assertRaises(ValueError, epoll.fileno) + + # close() can be called more than once + epoll.close() + + # operations must fail with ValueError("I/O operation on closed ...") + self.assertRaises(ValueError, epoll.modify, fd, select.EPOLLIN) + self.assertRaises(ValueError, epoll.poll, 1.0) + self.assertRaises(ValueError, epoll.register, fd, select.EPOLLIN) + self.assertRaises(ValueError, epoll.unregister, fd) + + def test_fd_non_inheritable(self): + epoll = select.epoll() + self.addCleanup(epoll.close) + self.assertEqual(os.get_inheritable(epoll.fileno()), False) + - def test_timeout_rounding(self): - # epoll_wait() has a resolution of 1 millisecond, check if the timeout - # is correctly rounded to the upper bound - epoll = select.epoll() - self.addCleanup(epoll.close) - for timeout in (1e-2, 1e-3, 1e-4): - t0 = time.monotonic() - epoll.poll(timeout) - dt = time.monotonic() - t0 - self.assertGreaterEqual(dt, timeout) - def test_main(): support.run_unittest(TestEPoll)