summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorCharles-François Natali <cf.natali@gmail.com>2013-10-25 15:56:00 (GMT)
committerCharles-François Natali <cf.natali@gmail.com>2013-10-25 15:56:00 (GMT)
commitc60dd5b0d4eee2bd239b91565d2ecaa582c4fca5 (patch)
treefd62ee0b2c0bf5cd99b63eda3d0a825c7aac8b39 /Lib
parent052058fa147419d9b48b02f04a8d0fe6c27a74b1 (diff)
downloadcpython-c60dd5b0d4eee2bd239b91565d2ecaa582c4fca5.zip
cpython-c60dd5b0d4eee2bd239b91565d2ecaa582c4fca5.tar.gz
cpython-c60dd5b0d4eee2bd239b91565d2ecaa582c4fca5.tar.bz2
test_selectors: make timeout-related errors report the actual elapsed timeout.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_selectors.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_selectors.py b/Lib/test/test_selectors.py
index ca09851..a2ffd62 100644
--- a/Lib/test/test_selectors.py
+++ b/Lib/test/test_selectors.py
@@ -264,18 +264,19 @@ class BaseSelectorTestCase(unittest.TestCase):
t = time()
self.assertEqual(1, len(s.select(0)))
self.assertEqual(1, len(s.select(-1)))
- self.assertTrue(time() - t < 0.5)
+ self.assertLess(time() - t, 0.5)
s.unregister(wr)
s.register(rd, selectors.EVENT_READ)
t = time()
self.assertFalse(s.select(0))
self.assertFalse(s.select(-1))
- self.assertTrue(time() - t < 0.5)
+ self.assertLess(time() - t, 0.5)
- t = time()
+ t0 = time()
self.assertFalse(s.select(1))
- self.assertTrue(0.5 < time() - t < 1.5)
+ t1 = time()
+ self.assertTrue(0.5 < t1 - t0 < 1.5, t1 - t0)
@unittest.skipUnless(hasattr(signal, "alarm"),
"signal.alarm() required for this test")