Commit 0fc940a0 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

test_bsddb3 tolerates smaller timeout on Windows (#2840)

bpo-30850: On Windows, test04_lock_timeout2() now tolerates 50 ms
whereas 100 ms is expected. The lock sometimes times out after only
58 ms. Windows clocks have a bad resolution and bad accuracy.
parent 123a58bf
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
TestCases for testing the locking sub-system. TestCases for testing the locking sub-system.
""" """
import sys
import time import time
import unittest import unittest
...@@ -10,7 +11,6 @@ from test_all import db, test_support, verbose, have_threads, \ ...@@ -10,7 +11,6 @@ from test_all import db, test_support, verbose, have_threads, \
if have_threads : if have_threads :
from threading import Thread from threading import Thread
import sys
if sys.version_info[0] < 3 : if sys.version_info[0] < 3 :
from threading import currentThread from threading import currentThread
else : else :
...@@ -129,7 +129,14 @@ class LockingTestCase(unittest.TestCase): ...@@ -129,7 +129,14 @@ class LockingTestCase(unittest.TestCase):
end_time=time.time() end_time=time.time()
deadlock_detection.end=True deadlock_detection.end=True
# Floating point rounding # Floating point rounding
self.assertGreaterEqual(end_time-start_time, 0.0999) if sys.platform == 'win32':
# bpo-30850: On Windows, tolerate 50 ms whereas 100 ms is expected.
# The lock sometimes times out after only 58 ms. Windows clocks
# have a bad resolution and bad accuracy.
min_dt = 0.050
else:
min_dt = 0.0999
self.assertGreaterEqual(end_time-start_time, min_dt)
self.env.lock_put(lock) self.env.lock_put(lock)
t.join() t.join()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment