Commit dedd5a28 authored by Jim Fulton's avatar Jim Fulton

Fix test to no longer depend on what time is

There's no reason to care.

(And a change in db root-object setup shifted the old test times.)
parent 61af5586
...@@ -6,18 +6,6 @@ special tests. ...@@ -6,18 +6,6 @@ special tests.
We'll make some assertions about time, so we'll take it over: We'll make some assertions about time, so we'll take it over:
>>> now = 1229959248
>>> def faux_time():
... global now
... now += 0.1
... return now
>>> import time
>>> time_time = time.time
>>> if isinstance(time,type):
... time.time = staticmethod(faux_time) # Jython
... else:
... time.time = faux_time
Commit a bunch of transactions: Commit a bunch of transactions:
>>> import ZODB.FileStorage, transaction >>> import ZODB.FileStorage, transaction
...@@ -63,28 +51,32 @@ seems best and set the next record to that: ...@@ -63,28 +51,32 @@ seems best and set the next record to that:
>>> it.close() >>> it.close()
>>> it = ZODB.FileStorage.FileIterator('data.fs', tids[1]) >>> it = ZODB.FileStorage.FileIterator('data.fs', tids[1])
Scan forward data.fs:<OFFSET> looking for '\x03z\xbd\xd8\xd06\x9c\xcc' ... # doctest: +ELLIPSIS
Scan forward data.fs:<OFFSET> looking for '...'
>>> it.next().tid == tids[1] >>> it.next().tid == tids[1]
True True
>>> it.close() >>> it.close()
>>> it = ZODB.FileStorage.FileIterator('data.fs', tids[30]) >>> it = ZODB.FileStorage.FileIterator('data.fs', tids[30])
Scan forward data.fs:<OFFSET> looking for '\x03z\xbd\xd8\xdc\x96.\xcc' ... # doctest: +ELLIPSIS
Scan forward data.fs:<OFFSET> looking for '...'
>>> it.next().tid == tids[30] >>> it.next().tid == tids[30]
True True
>>> it.close() >>> it.close()
>>> it = ZODB.FileStorage.FileIterator('data.fs', tids[70]) >>> it = ZODB.FileStorage.FileIterator('data.fs', tids[70])
Scan backward data.fs:<OFFSET> looking for '\x03z\xbd\xd8\xed\xa7>\xcc' ... # doctest: +ELLIPSIS
Scan backward data.fs:<OFFSET> looking for '...'
>>> it.next().tid == tids[70] >>> it.next().tid == tids[70]
True True
>>> it.close() >>> it.close()
>>> it = ZODB.FileStorage.FileIterator('data.fs', tids[-2]) >>> it = ZODB.FileStorage.FileIterator('data.fs', tids[-2])
Scan backward data.fs:<OFFSET> looking for '\x03z\xbd\xd8\xfa\x06\xd0\xcc' ... # doctest: +ELLIPSIS
Scan backward data.fs:<OFFSET> looking for '...'
>>> it.next().tid == tids[-2] >>> it.next().tid == tids[-2]
True True
...@@ -118,14 +110,16 @@ starting point, or just pick up where another iterator left off: ...@@ -118,14 +110,16 @@ starting point, or just pick up where another iterator left off:
>>> it.close() >>> it.close()
>>> it = ZODB.FileStorage.FileIterator('data.fs', tids[50], pos=poss[50]) >>> it = ZODB.FileStorage.FileIterator('data.fs', tids[50], pos=poss[50])
Scan backward data.fs:<OFFSET> looking for '\x03z\xbd\xd8\xe5\x1e\xb6\xcc' ... # doctest: +ELLIPSIS
Scan backward data.fs:<OFFSET> looking for '...'
>>> it.next().tid == tids[50] >>> it.next().tid == tids[50]
True True
>>> it.close() >>> it.close()
>>> it = ZODB.FileStorage.FileIterator('data.fs', tids[49], pos=poss[50]) >>> it = ZODB.FileStorage.FileIterator('data.fs', tids[49], pos=poss[50])
Scan backward data.fs:<OFFSET> looking for '\x03z\xbd\xd8\xe4\xb1|\xcc' ... # doctest: +ELLIPSIS
Scan backward data.fs:<OFFSET> looking for '...'
>>> it.next().tid == tids[49] >>> it.next().tid == tids[49]
True True
...@@ -172,5 +166,4 @@ Even if we write more transactions: ...@@ -172,5 +166,4 @@ Even if we write more transactions:
.. Cleanup .. Cleanup
>>> time.time = time_time
>>> db.close() >>> db.close()
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