diff --git a/src/ocrmypdf/_pipeline.py b/src/ocrmypdf/_pipeline.py index cad9d74b..fd1aadb4 100644 --- a/src/ocrmypdf/_pipeline.py +++ b/src/ocrmypdf/_pipeline.py @@ -183,7 +183,7 @@ def validate_pdfinfo_options(context): ) raise InputFileError() else: - log.warn( + log.warning( "This PDF has a fillable form. " "Chances are it is a pure digital " "document that does not need OCR." diff --git a/tests/resources/acroform.pdf b/tests/resources/acroform.pdf new file mode 100644 index 00000000..b80eb44a Binary files /dev/null and b/tests/resources/acroform.pdf differ diff --git a/tests/test_acroform.py b/tests/test_acroform.py index cb188e80..44de63da 100644 --- a/tests/test_acroform.py +++ b/tests/test_acroform.py @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with OCRmyPDF. If not, see . +import logging + import pytest import ocrmypdf @@ -30,4 +32,11 @@ def acroform(resources): def test_acroform_and_redo(acroform, caplog, no_outpdf): with pytest.raises(ocrmypdf.exceptions.InputFileError): check_ocrmypdf(acroform, no_outpdf, '--redo-ocr') - assert '--redo-ocr is not currently possible' in caplog.text + assert '--redo-ocr is not currently possible' in caplog.text + + +def test_acroform_message(acroform, caplog, spoof_tesseract_noop, outpdf): + caplog.set_level(logging.INFO) + check_ocrmypdf(acroform, outpdf, env=spoof_tesseract_noop) + assert 'fillable form' in caplog.text + assert '--force-ocr' in caplog.text diff --git a/tests/test_main.py b/tests/test_main.py index 0e336d80..cc2686cf 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -276,7 +276,7 @@ def test_input_file_not_readable(caplog, resources, outdir, no_outpdf): input_file.chmod(0o000) result = run_ocrmypdf_api(input_file, no_outpdf) assert result == ExitCode.input_file - assert input_file in caplog.text + assert str(input_file) in caplog.text def test_input_file_not_a_pdf(caplog, no_outpdf):