lbry-rocksdb/rocksdb/tests/test_memtable.py
Jason Fried 2a66e20ca3 Column Family Support
Add support for Column Families in a runtime safe way.
Add unittests to test functionality
Insure all unittests are passing.
Cleaned up unittests to not use a fixed directory in tmp, but use tempfile
2018-11-06 02:26:47 +00:00

29 lines
762 B
Python

# content of test_sample.py
import rocksdb
import pytest
import shutil
import os
import tempfile
def test_open_skiplist_memtable_factory():
opts = rocksdb.Options()
opts.memtable_factory = rocksdb.SkipListMemtableFactory()
opts.create_if_missing = True
loc = tempfile.mkdtemp()
try:
test_db = rocksdb.DB(os.path.join(loc, "test"), opts)
finally:
shutil.rmtree(loc)
def test_open_vector_memtable_factory():
opts = rocksdb.Options()
opts.allow_concurrent_memtable_write = False
opts.memtable_factory = rocksdb.VectorMemtableFactory()
opts.create_if_missing = True
loc = tempfile.mkdtemp()
try:
test_db = rocksdb.DB(os.path.join(loc, "test"), opts)
finally:
shutil.rmtree(loc)