[Python-checkins] cpython: Fix sporadic failure of test_time.test_process_time() on Windows

victor.stinner python-checkins at python.org
Fri Jun 1 22:47:26 CEST 2012


http://hg.python.org/cpython/rev/bdc7ad1f05ef
changeset:   77291:bdc7ad1f05ef
parent:      77289:2a43088318ed
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Jun 01 22:45:23 2012 +0200
summary:
  Fix sporadic failure of test_time.test_process_time() on Windows

Use a threshold of 20 ms instead of 10 ms.

files:
  Lib/test/test_time.py |  7 +++++--
  1 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -380,10 +380,13 @@
         time.perf_counter()
 
     def test_process_time(self):
+        # process_time() should not include time spend during a sleep
         start = time.process_time()
-        time.sleep(0.1)
+        time.sleep(0.100)
         stop = time.process_time()
-        self.assertLess(stop - start, 0.01)
+        # use 20 ms because process_time() has usually a resolution of 15 ms
+        # on Windows
+        self.assertLess(stop - start, 0.020)
 
         info = time.get_clock_info('process_time')
         self.assertTrue(info.monotonic)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list