[Zope-Checkins] CVS: Zope/lib/python/ZODB/tests - TransactionalUndoStorage.py:1.29

Tim Peters tim.one@comcast.net
Thu, 8 May 2003 14:48:50 -0400


Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv19031/lib/python/ZODB/tests

Modified Files:
	TransactionalUndoStorage.py 
Log Message:
checkTransactionalUndoAfterPack():  This failed sporadically on Windows,
due to the coarseness of time.time() on Windows.  It looks like an
attempt was made before to fix this, and also removed a wrong comment
explaining that fix.  .pack() used to be documented incorrectly, saying
that stuff before the pack time was packed away.  It's actually the case
that stuff before *or equal to* the pack time is packed away, and that's
a crucial distinction on Windows because time.time() often (usually,
in fact) returns the same value on two successive calls.  The earlier
fix attempt tried to separate observed time.time() values, but did so
before the pack().  That's usually appropriate, but in this test we
really need to make sure that object revisions *after* the pack() get
timestamps distinct from the pack time (else they'll get packed away,
and the test isn't expecting that).


=== Zope/lib/python/ZODB/tests/TransactionalUndoStorage.py 1.28 => 1.29 ===
--- Zope/lib/python/ZODB/tests/TransactionalUndoStorage.py:1.28	Tue Apr 22 14:02:41 2003
+++ Zope/lib/python/ZODB/tests/TransactionalUndoStorage.py	Thu May  8 14:48:49 2003
@@ -483,14 +483,8 @@
         # Add a few object revisions
         oid = self._storage.new_oid()
         revid1 = self._dostore(oid, data=MinPO(51))
-        # For the pack(), we need a timestamp greater than revid1's timestamp.
-        # The semantics of pack()'s `t' argument is that all non-current
-        # revisions with an earlier timestamp will be packed away.  If they
-        # were equal (because the Windows clock resolution is too coarse),
-        # then we won't pack away the first revision.
-        now = packtime = time.time()
-        while packtime <= now:
-            packtime = time.time()
+        packtime = time.time()
+        snooze()                # time.time() now distinct from packtime
         revid2 = self._dostore(oid, revid=revid1, data=MinPO(52))
         revid3 = self._dostore(oid, revid=revid2, data=MinPO(53))
         # Now get the undo log