diff --git a/tests/spoof/tesseract_cache.py b/tests/spoof/tesseract_cache.py index db06aa8e..528e5a1e 100755 --- a/tests/spoof/tesseract_cache.py +++ b/tests/spoof/tesseract_cache.py @@ -100,6 +100,8 @@ def main(): # Convert non-standard but supported -psm to --psm sys.argv = ['--psm' if arg == '-psm' else arg for arg in sys.argv] + if '_OCRMYPDF_TEST_INFILE' not in os.environ: + real_tesseract() # test not properly set up source = os.environ['_OCRMYPDF_TEST_INFILE'] # required args = parser.parse_args() diff --git a/tests/test_main.py b/tests/test_main.py index 11e02993..e87e5163 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -349,10 +349,9 @@ def test_german(spoof_tesseract_cache, resources, outdir): sidecar, env=spoof_tesseract_cache, ) - print(os.environ) - assert ( - p.returncode == ExitCode.ok - ), "This test may fail if Tesseract language packs are missing" + if 'deu' not in tesseract.languages(): + pytest.xfail(reason="tesseract-deu language pack not installed") + assert p.returncode == ExitCode.ok, "Requires tesseract deu language pack" def test_klingon(resources, outpdf):