Пример #1
0
def setUpModule():
    try:
        options = {'path': './unittest-leveldb'}
        return implementations.LevelDB(options)
    except ModuleNotFoundError as mne:
        print(mne, file=stderr)
        raise
Пример #2
0
 def test_no_plyvel_support(self):
     # at this point we know level_db_supported is always true because otherwise it would have failed
     # at `setUpModule` and this test case would never have been called.
     implementations.leveldb.level_db_supported = False
     options = {}
     try:
         with self.assertRaises(Exception) as context:
             implementations.LevelDB(options)
         self.assertIn("plyvel module not found - try 'pip install plyvel",
                       str(context.exception))
     finally:
         implementations.leveldb.level_db_supported = True
Пример #3
0
 def test_plyvel_init_exception(self):
     options = {}
     with self.assertRaises(Exception) as context:
         implementations.LevelDB(options)
     self.assertIn("leveldb exception", str(context.exception))
Пример #4
0
 def db_factory(self):
     options = {'path': './unittest-leveldb'}
     return implementations.LevelDB(options)