[Zodb-checkins] CVS: ZODB3/ZODB/tests - StorageTestBase.py:1.25

Jeremy Hylton jeremy@zope.com
Mon, 17 Mar 2003 12:52:34 -0500


Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv3964/tests

Modified Files:
	StorageTestBase.py 
Log Message:
Backport snooze() helper from ZODB4.


=== ZODB3/ZODB/tests/StorageTestBase.py 1.24 => 1.25 ===
--- ZODB3/ZODB/tests/StorageTestBase.py:1.24	Wed Jan 22 11:58:39 2003
+++ ZODB3/ZODB/tests/StorageTestBase.py	Mon Mar 17 12:52:34 2003
@@ -24,6 +24,7 @@
 import pickle
 import string
 import sys
+import time
 import types
 import unittest
 from cPickle import Pickler, Unpickler
@@ -34,6 +35,15 @@
 from ZODB.tests.MinPO import MinPO
 
 ZERO = '\0'*8
+
+def snooze():
+    # In Windows, it's possible that two successive time.time() calls return
+    # the same value.  Tim guarantees that time never runs backwards.  You
+    # usually want to call this before you pack a storage, or must make other
+    # guarantees about increasing timestamps.
+    now = time.time()
+    while now == time.time():
+        time.sleep(0.1)
 
 def zodb_pickle(obj):
     """Create a pickle in the format expected by ZODB."""