]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-143528: Fix test_time.test_thread_time() (GH-143558) (#143559)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 8 Jan 2026 13:31:18 +0000 (14:31 +0100)
committerGitHub <noreply@github.com>
Thu, 8 Jan 2026 13:31:18 +0000 (13:31 +0000)
gh-143528: Fix test_time.test_thread_time() (GH-143558)

Tolerate 100 ms instead of 20 ms to support slow CIs.
(cherry picked from commit efaa56f73cb1dc4863894444425e753afb7b997c)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/test_time.py

index 5312faa50774ecfa71892fb306e98082e07d2b69..f66a37edb4cadfccd20a4dc244a7a3a1e0fa4142 100644 (file)
@@ -577,11 +577,10 @@ class TimeTestCase(unittest.TestCase):
 
         # thread_time() should not include time spend during a sleep
         start = time.thread_time()
-        time.sleep(0.100)
+        time.sleep(0.200)
         stop = time.thread_time()
-        # use 20 ms because thread_time() has usually a resolution of 15 ms
-        # on Windows
-        self.assertLess(stop - start, 0.020)
+        # gh-143528: use 100 ms to support slow CI
+        self.assertLess(stop - start, 0.100)
 
         info = time.get_clock_info('thread_time')
         self.assertTrue(info.monotonic)