coverage: test compile leptonica

This commit is contained in:
James R. Barlow
2018-11-02 01:55:25 -07:00
parent 77e87abe8f
commit 8b9ab25125
2 changed files with 11 additions and 1 deletions
+2 -1
View File
@@ -19,7 +19,6 @@
from cffi import FFI
ffibuilder = FFI()
ffibuilder.set_source("ocrmypdf.lib._leptonica", None)
ffibuilder.cdef("""
typedef signed char l_int8;
typedef unsigned char l_uint8;
@@ -324,5 +323,7 @@ lept_free(void *ptr);
""")
ffibuilder.set_source("ocrmypdf.lib._leptonica", None)
if __name__ == '__main__':
ffibuilder.compile(verbose=True)
+9
View File
@@ -78,3 +78,12 @@ def test_pickle(crom_pix):
pickled = dumps(pix)
pix2 = loads(pickled)
assert pix.mode == pix2.mode
def test_leptonica_compile(tmpdir):
from ocrmypdf.lib.compile_leptonica import ffibuilder
# Compile the library but build it somewhere that won't interfere with
# existing compiled library. Also compile in API mode so that we test
# the interfaces, even though we use it ABI mode.
ffibuilder.compile(tmpdir=tmpdir, target=(tmpdir /'lepttest.*'))