From 0cd424ffcbecf3b85e30c6476f1145e68b278549 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Thu, 28 Nov 2019 14:44:32 -0800 Subject: [PATCH] Enforce str-only environment for Windows since it's more strict --- tests/conftest.py | 2 ++ tests/test_main.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 1a63a5d2..9f796d3a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -205,6 +205,8 @@ def run_ocrmypdf_api(input_file, output_file, *args, env=None): if env: options.tesseract_env = env options.tesseract_env['_OCRMYPDF_TEST_INFILE'] = os.fspath(input_file) + if options.tesseract_env: + assert all(isinstance(v, (str, bytes)) for v in options.tesseract_env.values()) return api.run_pipeline(options, api=False) diff --git a/tests/test_main.py b/tests/test_main.py index 77ea154e..17946965 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -303,7 +303,7 @@ def test_maximum_options( def test_tesseract_missing_tessdata(resources, no_outpdf, tmpdir): env = os.environ.copy() - env['TESSDATA_PREFIX'] = tmpdir + env['TESSDATA_PREFIX'] = os.fspath(tmpdir) returncode = run_ocrmypdf_api( resources / 'graph.pdf', no_outpdf, '-v', '1', '--skip-text', env=env