Commit eaa9c142 authored by Tim Peters's avatar Tim Peters

checkExtendedIteration(): On Windows revids are often consecutive

integers, due to MS's slothful 18.2Hz updating of time.time().  The test
implicitly assumed in one spot that "the midpoint" between two revids was
strictly larger than the smaller one, but that wasn't true on Windows.
Adjusted the computation (as suggested by Guido) so that "strictly larger"
holds in the end even when the inputs are adjacent integers.
parent 07b977dd
...@@ -129,8 +129,12 @@ class ExtendedIteratorStorage(IteratorCompare): ...@@ -129,8 +129,12 @@ class ExtendedIteratorStorage(IteratorCompare):
revid3a = p64((U64(revid3) + U64(revid4)) / 2) revid3a = p64((U64(revid3) + U64(revid4)) / 2)
txniter = self._storage.iterator(revid2, revid3a) txniter = self._storage.iterator(revid2, revid3a)
self.iter_verify(txniter, [revid2, revid3], 12) self.iter_verify(txniter, [revid2, revid3], 12)
# Specify a lower bound somewhere in between values # Specify a lower bound somewhere in between values.
revid1a = p64((U64(revid1) + U64(revid2)) / 2) # revid2 == revid1+1 is very likely on Windows. Adding 1 before
# dividing ensures that "the midpoint" we compute is strictly larger
# than revid1.
revid1a = p64((U64(revid1) + 1 + U64(revid2)) / 2)
assert revid1 < revid1a
txniter = self._storage.iterator(revid1a, revid3a) txniter = self._storage.iterator(revid1a, revid3a)
self.iter_verify(txniter, [revid2, revid3], 12) self.iter_verify(txniter, [revid2, revid3], 12)
# Specify an empty range # Specify an empty range
...@@ -139,7 +143,7 @@ class ExtendedIteratorStorage(IteratorCompare): ...@@ -139,7 +143,7 @@ class ExtendedIteratorStorage(IteratorCompare):
# Specify a singleton range # Specify a singleton range
txniter = self._storage.iterator(revid3, revid3) txniter = self._storage.iterator(revid3, revid3)
self.iter_verify(txniter, [revid3], 13) self.iter_verify(txniter, [revid3], 13)
class IteratorDeepCompare: class IteratorDeepCompare:
def compare(self, storage1, storage2): def compare(self, storage1, storage2):
eq = self.assertEqual eq = self.assertEqual
......
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