Remove tesseract_env, --tesseract-env

This commit is contained in:
James R. Barlow
2020-06-09 00:39:53 -07:00
parent 21c0e045cb
commit 3b6f6782f0
5 changed files with 22 additions and 74 deletions
-2
View File
@@ -133,8 +133,6 @@ def run_ocrmypdf_api(input_file, output_file, *args):
str(arg) for arg in args if arg is not None
]
_parser, options, plugin_manager = get_parser_options_plugins(args=args)
if options.tesseract_env:
assert all(isinstance(v, (str, bytes)) for v in options.tesseract_env.values())
api.check_options(options, plugin_manager)
return api.run_pipeline(options, plugin_manager=None, api=False)
+3 -7
View File
@@ -70,13 +70,11 @@ def test_content_preservation(resources, outpdf):
assert len(page.images) > 1, "masks were rasterized"
def test_no_languages(tmp_path):
env = os.environ.copy()
def test_no_languages(tmp_path, monkeypatch):
(tmp_path / 'tessdata').mkdir()
env['TESSDATA_PREFIX'] = fspath(tmp_path)
monkeypatch.setenv('TESSDATA_PREFIX', fspath(tmp_path))
with pytest.raises(MissingDependencyError):
tesseract.get_languages(tesseract_env=env)
tesseract.get_languages()
def test_image_too_large_hocr(monkeypatch, resources, outdir):
@@ -95,7 +93,6 @@ def test_image_too_large_hocr(monkeypatch, resources, outdir):
pagesegmode=None,
user_words=None,
user_patterns=None,
tesseract_env=None,
)
assert "name='ocr-capabilities'" in Path(outdir / 'out.hocr').read_text()
@@ -116,7 +113,6 @@ def test_image_too_large_pdf(monkeypatch, resources, outdir):
pagesegmode=None,
user_words=None,
user_patterns=None,
tesseract_env=None,
)
assert Path(outdir / 'txt.txt').read_text() == '[skipped page]'
if os.name != 'nt': # different semantics