diff --git a/src/ocrmypdf/leptonica.py b/src/ocrmypdf/leptonica.py index 20394d3d..dd3a543b 100644 --- a/src/ocrmypdf/leptonica.py +++ b/src/ocrmypdf/leptonica.py @@ -921,6 +921,8 @@ def get_leptonica_version(): Caveat: Leptonica expects the caller to free this memory. We don't, since that would involve binding to libc to access libc.free(), a pointless effort to reclaim 100 bytes of memory. + + Reminder that this returns "leptonica-1.xx" or "leptonica-1.yy.0". """ return ffi.string(lept.getLeptonicaVersion()).decode() diff --git a/tests/test_lept.py b/tests/test_lept.py index bf3cac83..3dcf1fa7 100644 --- a/tests/test_lept.py +++ b/tests/test_lept.py @@ -97,9 +97,11 @@ def test_file_not_found(): lp.Pix.open("does_not_exist1") +@pytest.mark.skipif( + lp.get_leptonica_version() < 'leptonica-1.79.0', + reason="test not reliable on all platforms for old leptonica", +) def test_error_trap(): with pytest.raises(lp.LeptonicaError, match=r"Error in pixReadMem"): with lp._LeptonicaErrorTrap(): lp.Pix(lp.lept.pixReadMem(lp.ffi.NULL, 0)) - with lp._LeptonicaErrorTrap_Redirect(): - lp.Pix(lp.lept.pixReadMem(lp.ffi.NULL, 0))