mirror of
https://github.com/ocrmypdf/OCRmyPDF.git
synced 2025-12-30 00:31:59 +00:00
Tests: accept rich path objects without having to str() everything
This commit is contained in:
parent
cd8db60b06
commit
7f0b8621f3
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user