WIP implement sync done in resume sync for mock driver

This commit is contained in:
lash 2022-03-29 11:28:37 +00:00
parent ecb123f495
commit 7078adaf7e
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 10 additions and 3 deletions

View File

@ -110,7 +110,6 @@ class SyncDriver:
if self.block_callback != None:
self.block_callback(block, None)
last_block = block
try:
self.process(conn, item, block, tx_start)
except IndexError:
@ -120,6 +119,9 @@ class SyncDriver:
if self.post_callback != None:
self.post_callback()
if self.store.target > -1 and block.number >= self.store.target:
self.running = False
self.idle(interval)

View File

@ -195,7 +195,10 @@ class MockDriver(SyncDriver):
def get(self, conn, item):
return self.blocks[item.cursor]
try:
return self.blocks[item.cursor]
except KeyError:
raise NoBlockForYou()
def process(self, conn, item, block, tx_start):

View File

@ -128,7 +128,9 @@ class TestFilter(unittest.TestCase):
store = SyncFsStore(self.path, state_event_callback=state_event_handler, filter_state_event_callback=filter_state_event_handler)
drv = MockDriver(store)
fltr_one = MockFilter('foo')
store.register(fltr_one)
drv = MockDriver(store, target=1)
generator.apply(drv, offset=1)
drv.run(self.conn, interval=0.1)