tests: new test to confirm correct printing of tesseract install advice
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user