commit 18f9b9bd1f5bcfc18a9c8f4fa9dea2be42951cd5
parent 7078adaf7ef7078c7f9bba3a01e6e1e0a0f41782
Author: lash <dev@holbrook.no>
Date: Tue, 29 Mar 2022 12:56:15 +0000
complete test for sync resume
Diffstat:
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/chainsyncer/driver.py b/chainsyncer/driver.py
@@ -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
diff --git a/tests/test_session.py b/tests/test_session.py
@@ -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__':