]> granicus.if.org Git - python/commitdiff
(Merge 3.3) Issue #20311: Revert 033137c12d88 (02f9db3e684e),
authorVictor Stinner <victor.stinner@gmail.com>
Sat, 25 Jan 2014 13:40:04 +0000 (14:40 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Sat, 25 Jan 2014 13:40:04 +0000 (14:40 +0100)
select.epoll.poll() rounds again the timeout towards zero

1  2 
Lib/test/test_epoll.py
Misc/NEWS
Modules/selectmodule.c

index 58dd92f7e19f2f641ab69e410e7fbc00f82109ac,871efb2d31436a5b719bbaaab33d0443f50cdb53..0c88cc424cf29d5bb1e95e6e5f0eff3be98b5ec9
@@@ -225,46 -217,6 +225,35 @@@ class TestEPoll(unittest.TestCase)
          server.close()
          ep.unregister(fd)
  
-     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_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_main():
      support.run_unittest(TestEPoll)
diff --cc Misc/NEWS
Simple merge
Simple merge