diff --git a/src/ocrmypdf/api.py b/src/ocrmypdf/api.py index b735f398..a05edbc1 100644 --- a/src/ocrmypdf/api.py +++ b/src/ocrmypdf/api.py @@ -158,7 +158,7 @@ def create_options(*, input_file, output_file, **kwargs): # If we are running a Tesseract spoof, ensure it knows what the input file is if os.environ.get('PYTEST_CURRENT_TEST') and options.tesseract_env: - options.tesseract_env['_OCRMYPDF_TEST_INFILE'] = input_file + options.tesseract_env['_OCRMYPDF_TEST_INFILE'] = os.fspath(input_file) return options diff --git a/tests/conftest.py b/tests/conftest.py index b443ac1f..e875315a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -183,7 +183,7 @@ def check_ocrmypdf(input_file, output_file, *args, env=None): api.check_options(options) if env: options.tesseract_env = env - options.tesseract_env['_OCRMYPDF_TEST_INFILE'] = input_file + options.tesseract_env['_OCRMYPDF_TEST_INFILE'] = os.fspath(input_file) result = api.run_pipeline(options, api=True) assert result == 0