Exemplo n.º 1
0
 def test_getStorageTids_notices_db_packing(self):
     tids = getStorageTids(self.storage)  # prime the cache
     time.sleep(0.001)  # hmm, will this help?
     self.packDatabase()
     tids_again = getStorageTids(self.storage, cache_for=-1)
     self.assertEqual(
         len(tids_again), 1,
         'the impossible happened: my code has a bug?  or your clock is ticking backwards?\n'
         'tids:       {tids!r}\n'
         'tids_again: {tids_again!r}\n'
         'should be:  {should_be!r}\n'.format(
             tids=tids,
             tids_again=tids_again,
             should_be=[t.tid for t in self.storage.iterator()],
         ))
Exemplo n.º 2
0
 def test_getStorageTids_notices_new_commits_when_cache_expires(self):
     tids = getStorageTids(self.storage)[:]
     self.root['bob'] = None
     transaction.commit()
     tids_again = getStorageTids(self.storage, cache_for=-1)
     self.assertEqual(len(tids_again), len(tids) + 1)
Exemplo n.º 3
0
 def test_getStorageTids_cached(self):
     tids = getStorageTids(self.storage)
     tids_again = getStorageTids(self.storage)
     self.assertEqual(tids, tids_again)
Exemplo n.º 4
0
 def test_getStorageTids_no_cache(self):
     tids = getStorageTids(self.storage)
     self.assertEqual(len(tids), 3)
Exemplo n.º 5
0
 def __init__(self, connection):
     self._connection = connection
     self._storage = IStorageIteration(connection._storage)
     self._tids = cache.getStorageTids(self._storage)
     self._iterators = []
Exemplo n.º 6
0
 def __init__(self, connection):
     self._connection = connection
     self._storage = IStorageIteration(connection._storage)
     self._tids = cache.getStorageTids(self._storage)
     self._iterators = []
Exemplo n.º 7
0
 def __init__(self, connection):
     self._connection = connection
     self._storage = connection._storage
     self._tids = cache.getStorageTids(self._storage)