test_rocksdb.py (852B)
1 # standard imports 2 import unittest 3 import logging 4 5 # local imports 6 from chainsyncer.store.rocksdb import SyncRocksDbStore 7 from chainsyncer.unittest.store import ( 8 TestStoreBase, 9 filter_change_callback, 10 state_change_callback, 11 ) 12 13 logging.basicConfig(level=logging.DEBUG) 14 logg = logging.getLogger() 15 16 class StoreFactory: 17 18 def __init__(self, path): 19 self.path = path 20 21 22 def create(self, session_id=None): 23 return SyncRocksDbStore(self.path, session_id=session_id, state_event_callback=state_change_callback, filter_state_event_callback=filter_change_callback) 24 25 26 class TestRocksDb(TestStoreBase): 27 28 def setUp(self): 29 super(TestRocksDb, self).setUp() 30 self.store_factory = StoreFactory(self.path).create 31 32 33 if __name__ == '__main__': 34 TestStoreBase.link(TestRocksDb) 35 unittest.main()