Adjust test to support Tesseract 5 working harder to find its files

This commit is contained in:
James R. Barlow
2021-11-13 01:16:35 -08:00
parent 45020a7fcd
commit e3126d2806
3 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ class TesseractVersion(StrictVersion):
super().parse(vstring + '-0')
def version():
def version() -> str:
return get_version('tesseract', regex=r'tesseract\s(.+)')
+2 -2
View File
@@ -124,7 +124,7 @@ def _fix_process_args(args, env, kwargs):
@lru_cache(maxsize=None)
def get_version(
program: str, *, version_arg: str = '--version', regex=r'(\d+(\.\d+)*)', env=None
):
) -> str:
"""Get the version of the specified program
Arguments:
@@ -145,7 +145,7 @@ def get_version(
check=True,
env=env,
)
output = proc.stdout
output: str = proc.stdout
except FileNotFoundError as e:
raise MissingDependencyError(
f"Could not find program '{program}' on the PATH"
+3
View File
@@ -180,6 +180,9 @@ def test_maximum_options(renderer, output_type, resources, outpdf):
)
@pytest.mark.skipif(
tesseract.version() >= '5', reason="tess 5 tries harder to find its files"
)
def test_tesseract_missing_tessdata(monkeypatch, resources, no_outpdf, tmpdir):
monkeypatch.setenv("TESSDATA_PREFIX", os.fspath(tmpdir))
with pytest.raises(MissingDependencyError):