use pytest

This commit is contained in:
twmht 2017-04-25 19:33:42 +08:00
parent 995e7c77b8
commit f18c09e1cd
2 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,22 @@
import struct as py_struct
from interfaces import AssociativeMergeOperator
class UintAddOperator(AssociativeMergeOperator):
def merge(self, key, existing_value, value):
if existing_value:
s = py_struct.unpack('Q', existing_value)[0] + py_struct.unpack('Q', value)[0]
return (True, py_struct.pack('Q', s))
return (True, value)
def name(self):
return b'uint64add'
class StringAppendOperator(AssociativeMergeOperator):
def merge(self, key, existing_value, value):
if existing_value:
s = existing_value + ',' + value
return (True, s)
return (True, value)
def name(self):
return b'StringAppendOperator'

View file

@ -43,6 +43,7 @@ setup(
package_dir={'rocksdb': 'rocksdb'}, package_dir={'rocksdb': 'rocksdb'},
packages=find_packages('.'), packages=find_packages('.'),
ext_modules=cythonize([mod1]), ext_modules=cythonize([mod1]),
test_suite='rocksdb.tests', setup_requires=['pytest-runner'],
tests_require=['pytest'],
include_package_data=True include_package_data=True
) )