def test_german(resources, outdir): # Produce a sidecar too - implicit test that system locale is set up # properly. It is fine that we are testing -l deu on a French file because # we are exercising the functionality not going for accuracy. sidecar = outdir / 'francais.txt' try: check_ocrmypdf( resources / 'francais.pdf', outdir / 'francais.pdf', '-l', 'deu', # more commonly installed '--sidecar', sidecar, '--plugin', 'tests/plugins/tesseract_cache.py', ) except MissingDependencyError: if 'deu' not in tesseract.get_languages(): pytest.xfail(reason="tesseract-deu language pack not installed") raise
def test_no_languages(tmp_path, monkeypatch): (tmp_path / 'tessdata').mkdir() monkeypatch.setenv('TESSDATA_PREFIX', fspath(tmp_path)) with pytest.raises(MissingDependencyError): tesseract.get_languages()
def languages(options): return tesseract.get_languages()