Adjust test to support Tesseract 5 working harder to find its files
This commit is contained in:
@@ -74,7 +74,7 @@ class TesseractVersion(StrictVersion):
|
||||
super().parse(vstring + '-0')
|
||||
|
||||
|
||||
def version():
|
||||
def version() -> str:
|
||||
return get_version('tesseract', regex=r'tesseract\s(.+)')
|
||||
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user