Skip to content

Commit be949bb

Browse files
committed
gh-88494: Reduce CLOCK_RES to 1 ms in tests
On Windows, time.monotonic() now calls QueryPerformanceCounter() which has a resolution of 100 ns. Reduce CLOCK_RES from 50 or 100 ms to 1 ms.
1 parent 23d0371 commit be949bb

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

Lib/test/_test_multiprocessing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@
8484
raise unittest.SkipTest("libasan has a pthread_create() dead lock related to thread+fork")
8585

8686

87-
# gh-110666: Tolerate a difference of 100 ms when comparing timings
87+
# gh-110666: Tolerate a difference of 1 ms when comparing timings
8888
# (clock resolution)
89-
CLOCK_RES = 0.100
89+
CLOCK_RES = 0.001
9090

9191

9292
def latin(s):

Lib/test/test_asyncio/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@
3636
from test.support import threading_helper
3737

3838

39-
# Use the maximum known clock resolution (gh-75191, gh-110088): Windows
40-
# GetTickCount64() has a resolution of 15.6 ms. Use 50 ms to tolerate rounding
41-
# issues.
42-
CLOCK_RES = 0.050
39+
# Tolerate 1 ms difference when comparing timings.
40+
CLOCK_RES = 0.001
4341

4442

4543
def data_file(*filename):

Lib/test/test_capi/test_time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
SEC_TO_NS = 10 ** 9
1010
DAY_TO_SEC = (24 * 60 * 60)
1111
# Worst clock resolution: maximum delta between two clock reads.
12-
CLOCK_RES = 0.050
12+
CLOCK_RES = 0.001
1313

1414

1515
class CAPITest(unittest.TestCase):

0 commit comments

Comments
 (0)