]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix sporadic failure of test_time.test_process_time() on Windows
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 1 Jun 2012 20:45:23 +0000 (22:45 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 1 Jun 2012 20:45:23 +0000 (22:45 +0200)
Use a threshold of 20 ms instead of 10 ms.

Lib/test/test_time.py

index c8ce158fe1f6d53203aab40c6ae005845360b0df..02f05c364a71a69c15c38261c9938ea77acec34c 100644 (file)
@@ -380,10 +380,13 @@ class TimeTestCase(unittest.TestCase):
         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)