complete test for sync resume

This commit is contained in:
lash 2022-03-29 12:56:15 +00:00
parent 7078adaf7e
commit 18f9b9bd1f
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 8 additions and 4 deletions

View File

@ -118,7 +118,8 @@ class SyncDriver:
time.sleep(self.yield_delay)
if self.post_callback != None:
self.post_callback()
logg.debug('fooo')
if self.store.target > -1 and block.number >= self.store.target:
self.running = False

View File

@ -117,7 +117,7 @@ class TestFilter(unittest.TestCase):
def test_driver_interrupt_sync(self):
drv = MockDriver(self.store, interrupt_block=1)
drv = MockDriver(self.store, interrupt_block=1, target=2)
generator = MockBlockGenerator()
generator.generate([3, 1, 2], driver=drv)
@ -130,9 +130,12 @@ class TestFilter(unittest.TestCase):
store = SyncFsStore(self.path, state_event_callback=state_event_handler, filter_state_event_callback=filter_state_event_handler)
fltr_one = MockFilter('foo')
store.register(fltr_one)
drv = MockDriver(store, target=1)
drv = MockDriver(store)
generator.apply(drv, offset=1)
drv.run(self.conn, interval=0.1)
with self.assertRaises(SyncDone) as e:
drv.run(self.conn, interval=0.1)
self.assertEqual(e, 2)
if __name__ == '__main__':