diff --git a/tests/test_validation.py b/tests/test_validation.py index 9b7f1b51..fca0cc32 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -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):