Commit 5f921dfd authored by Tim Peters's avatar Tim Peters

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).
parent 697fa445
...@@ -483,14 +483,8 @@ class TransactionalUndoStorage: ...@@ -483,14 +483,8 @@ class TransactionalUndoStorage:
# Add a few object revisions # Add a few object revisions
oid = self._storage.new_oid() oid = self._storage.new_oid()
revid1 = self._dostore(oid, data=MinPO(51)) revid1 = self._dostore(oid, data=MinPO(51))
# For the pack(), we need a timestamp greater than revid1's timestamp. packtime = time.time()
# The semantics of pack()'s `t' argument is that all non-current snooze() # time.time() now distinct from packtime
# 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()
revid2 = self._dostore(oid, revid=revid1, data=MinPO(52)) revid2 = self._dostore(oid, revid=revid1, data=MinPO(52))
revid3 = self._dostore(oid, revid=revid2, data=MinPO(53)) revid3 = self._dostore(oid, revid=revid2, data=MinPO(53))
# Now get the undo log # Now get the undo log
......
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