summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-07-24 11:01:59 (GMT)
committerGitHub <noreply@github.com>2017-07-24 11:01:59 (GMT)
commit0fc940a09ae6636e78f94ecf6436b8de14bd1c45 (patch)
tree2c6153ae0101fae046739fcd9eb8004d85019998
parent123a58bfc893ee30498b0d208dc1bbef34324772 (diff)
downloadcpython-0fc940a09ae6636e78f94ecf6436b8de14bd1c45.zip
cpython-0fc940a09ae6636e78f94ecf6436b8de14bd1c45.tar.gz
cpython-0fc940a09ae6636e78f94ecf6436b8de14bd1c45.tar.bz2
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.
-rw-r--r--Lib/bsddb/test/test_lock.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/bsddb/test/test_lock.py b/Lib/bsddb/test/test_lock.py
index 0b08aa1..22bf8cd 100644
--- a/Lib/bsddb/test/test_lock.py
+++ b/Lib/bsddb/test/test_lock.py
@@ -2,6 +2,7 @@
TestCases for testing the locking sub-system.
"""
+import sys
import time
import unittest
@@ -10,7 +11,6 @@ from test_all import db, test_support, verbose, have_threads, \
if have_threads :
from threading import Thread
- import sys
if sys.version_info[0] < 3 :
from threading import currentThread
else :
@@ -129,7 +129,14 @@ class LockingTestCase(unittest.TestCase):
end_time=time.time()
deadlock_detection.end=True
# 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)
t.join()