Allow memory-only syncing
This commit is contained in:
33
tests/store/test_0_mem.py
Normal file
33
tests/store/test_0_mem.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# standard imports
|
||||
import unittest
|
||||
import logging
|
||||
|
||||
# external imports
|
||||
from shep import State
|
||||
|
||||
# local imports
|
||||
from chainsyncer.store.mem import SyncMemStore
|
||||
from chainsyncer.unittest.store import TestStoreBase
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logg = logging.getLogger()
|
||||
|
||||
|
||||
class StoreFactory:
|
||||
|
||||
def create(self, session_id=None):
|
||||
return SyncMemStore(session_id=session_id)
|
||||
|
||||
|
||||
class TestMem(TestStoreBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestMem, self).setUp()
|
||||
self.store_factory = StoreFactory().create
|
||||
self.persist = False
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
TestStoreBase.link(TestMem)
|
||||
# Remove tests that test persistence of state
|
||||
unittest.main()
|
||||
@@ -4,7 +4,11 @@ import logging
|
||||
|
||||
# local imports
|
||||
from chainsyncer.store.rocksdb import SyncRocksDbStore
|
||||
from chainsyncer.unittest.store import TestStoreBase
|
||||
from chainsyncer.unittest.store import (
|
||||
TestStoreBase,
|
||||
filter_change_callback,
|
||||
state_change_callback,
|
||||
)
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logg = logging.getLogger()
|
||||
@@ -16,7 +20,7 @@ class StoreFactory:
|
||||
|
||||
|
||||
def create(self, session_id=None):
|
||||
return SyncRocksDbStore(self.path, session_id=session_id)
|
||||
return SyncRocksDbStore(self.path, session_id=session_id, state_event_callback=state_change_callback, filter_state_event_callback=filter_change_callback)
|
||||
|
||||
|
||||
class TestRocksDb(TestStoreBase):
|
||||
|
||||
Reference in New Issue
Block a user