Commit f08b40e1 authored by Julien Muchembled's avatar Julien Muchembled

windows: fix failures due to low-precision of time.time()

This fixes the following random failure:

Failure in test checkBaseHistory (ZODB.tests.testDemoStorage.DemoStorageTests)
Traceback (most recent call last):
  File "unittest\case.py", line 384, in _executeTestPart
    function()
  File "ZODB\tests\testDemoStorage.py", line 96, in checkBaseHistory
    self._checkHistory(base_only())
  File "ZODB\tests\HistoryStorage.py", line 46, in _checkHistory
    self.assertLess(a, b)
  File "unittest\case.py", line 1026, in assertLess
    self.fail(self._formatMessage(msg, standardMsg))
  File "unittest\case.py", line 508, in fail
    raise self.failureException(msg)
AssertionError: 1465433823.260304 not less than 1465433823.260304
parent 53c31a5f
......@@ -17,7 +17,8 @@ Any storage that supports the history() method should be able to pass
all these tests.
"""
from time import time
import sys
from time import time, sleep
from ZODB.tests.MinPO import MinPO
class HistoryStorage:
......@@ -31,6 +32,9 @@ class HistoryStorage:
self.assertRaises(KeyError,self._storage.history,oid)
revids = [None]
for data in data:
if sys.platform == 'win32':
# time.time() has a precision of 1ms on Windows.
sleep(0.001)
revids.append(self._dostore(oid, revids[-1], MinPO(data)))
revids.reverse()
del revids[-1]
......
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