Tests: accept rich path objects without having to str() everything

This commit is contained in:
James R. Barlow 2017-07-21 16:39:22 -07:00
parent cd8db60b06
commit 7f0b8621f3
2 changed files with 5 additions and 4 deletions

View File

@ -129,7 +129,8 @@ def run_ocrmypdf(input_file, output_file, *args, env=None):
if env is None:
env = os.environ
p_args = OCRMYPDF + list(args) + [str(input_file), str(output_file)]
p_args = OCRMYPDF + [str(arg) for arg in args] + \
[str(input_file), str(output_file)]
p = Popen(
p_args, close_fds=True, stdout=PIPE, stderr=PIPE,
universal_newlines=True, env=env)

View File

@ -755,7 +755,7 @@ language_model_penalty_non_freq_dict_word 0
check_ocrmypdf(
resources / 'ccitt.pdf', outdir / 'out.pdf',
'--tesseract-config', str(cfg_file))
'--tesseract-config', cfg_file)
@pytest.mark.parametrize('renderer', RENDERERS)
@ -765,7 +765,7 @@ def test_tesseract_config_notfound(renderer, resources, outdir):
p, out, err = run_ocrmypdf(
resources / 'ccitt.pdf', outdir / 'out.pdf',
'--pdf-renderer', renderer,
'--tesseract-config', str(cfg_file))
'--tesseract-config', cfg_file)
assert "Can't open" in err, "No error message about missing config file"
assert p.returncode == ExitCode.ok
@ -781,7 +781,7 @@ THIS FILE IS INVALID
p, out, err = run_ocrmypdf(
resources / 'ccitt.pdf', outdir / 'out.pdf',
'--pdf-renderer', renderer,
'--tesseract-config', str(cfg_file))
'--tesseract-config', cfg_file)
assert "parameter not found" in err, "No error message"
assert p.returncode == ExitCode.invalid_config