Disable test_error_trap for Leptonica < 1.79
Old error trap seems unreliable in the first place so difficult to set up a test.
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
+4
-2
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user