[Python-checkins] cpython: Issue #20452: Fix test_time_and_call_at() of test_asyncio on Windows

victor.stinner python-checkins at python.org
Sat Feb 1 02:22:33 CET 2014


http://hg.python.org/cpython/rev/60a960434e5c
changeset: 88872:60a960434e5c
user: Victor Stinner <victor.stinner at gmail.com>
date: Sat Feb 01 02:18:52 2014 +0100
summary:
 Issue #20452: Fix test_time_and_call_at() of test_asyncio on Windows
Use the granularity to check the minimum time delta, instead of arbitrary
value.
files:
 Lib/test/test_asyncio/test_base_events.py | 15 +++++-----
 1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -116,17 +116,18 @@
 self.loop.stop()
 
 self.loop._process_events = unittest.mock.Mock()
- when = self.loop.time() + 0.1
+ delay = 0.1
+
+ when = self.loop.time() + delay
 self.loop.call_at(when, cb)
 t0 = self.loop.time()
 self.loop.run_forever()
 dt = self.loop.time() - t0
- self.assertTrue(0.09 <= dt <= 0.9,
- # Issue #20452: add more info in case of failure,
- # to try to investigate the bug
- (dt,
- self.loop._granularity,
- time.get_clock_info('monotonic')))
+
+ self.assertGreaterEqual(dt, delay - self.loop._granularity, dt)
+ # tolerate a difference of +800 ms because some Python buildbots
+ # are really slow
+ self.assertLessEqual(dt, 0.9, dt)
 
 def test_run_once_in_executor_handle(self):
 def cb():
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /