tests: new test to confirm correct printing of tesseract install advice

This commit is contained in:
James R. Barlow
2022-08-01 12:31:37 -07:00
parent 5b57520c98
commit 5fe3102e4e
+11
View File
@@ -70,6 +70,17 @@ def test_old_tesseract_error():
vd.check_options(*make_opts_pm(pdf_renderer='sandwich', language='eng'))
def test_tesseract_not_installed(caplog):
with patch('ocrmypdf.subprocess.run') as not_found:
not_found.side_effect = FileNotFoundError('tesseract')
with pytest.raises(MissingDependencyError, match="Could not find program"):
vd.check_options(*make_opts_pm())
assert (
"'tesseract' could not be executed" in caplog.text
), "Error message not printed"
assert 'install' in caplog.text, "Install advice not printed"
not_found.assert_called()
def test_lossless_redo():
with pytest.raises(BadArgsError):