subset_test: fix mock test with uharfbuzz>=0.30 new 'repack_with_tag' method

This commit is contained in:
Cosimo Lupo 2022-08-15 12:10:13 +02:00
parent 615d62ab25
commit 0f33634a9e

View File

@ -819,13 +819,20 @@ class SubsetTest:
if not have_uharfbuzz:
pytest.skip("uharfbuzz is not installed")
if not ok:
# pretend hb.repack returns an error
# pretend hb.repack/repack_with_tag return an error
import uharfbuzz as hb
def mock_repack(data, obj_list):
raise hb.RepackerError("mocking")
monkeypatch.setattr(hb, "repack", mock_repack)
if hasattr(hb, "repack_with_tag"): # uharfbuzz >= 0.30.0
def mock_repack_with_tag(tag, data, obj_list):
raise hb.RepackerError("mocking")
monkeypatch.setattr(hb, "repack_with_tag", mock_repack_with_tag)
else:
if have_uharfbuzz:
# pretend uharfbuzz is not installed