Fix test_outputtype_none on Windows and cleanup docs
This commit is contained in:
@@ -104,6 +104,9 @@ This produces a file named "output.pdf" and a companion text file named
|
||||
because of options like ``--skip-big`` or ``--tesseract-timeout``, those pages
|
||||
will not be in the sidecar.
|
||||
|
||||
If you don't want to generate the output PDF, use ``--output-type=none`` to
|
||||
avoid generating one. Set the output filename to ``-`` (i.e. redirect to stdout).
|
||||
|
||||
To extract all text from a PDF, whether generated from OCR or otherwise,
|
||||
use a program like Poppler's ``pdftotext`` or ``pdfgrep``.
|
||||
|
||||
|
||||
@@ -78,11 +78,11 @@ def check_options_output(options):
|
||||
"`--pdf-renderer auto` (the default) to avoid this issue."
|
||||
)
|
||||
|
||||
if options.output_type == 'none' and options.output_file != os.devnull:
|
||||
if options.output_type == 'none' and options.output_file not in (os.devnull, '-'):
|
||||
raise BadArgsError(
|
||||
"Since you specified `--pdf-renderer none`, the output file "
|
||||
"Since you specified `--output-type none`, the output file "
|
||||
f"{options.output_file} cannot be produced. Set the output file to "
|
||||
f"{os.devnull} to suppress this message."
|
||||
f"`-` to suppress this message."
|
||||
)
|
||||
|
||||
lossless_reconstruction = False
|
||||
|
||||
+2
-3
@@ -916,9 +916,9 @@ def test_outputtype_none_bad_setup(resources, outpdf):
|
||||
|
||||
|
||||
def test_outputtype_none(resources, outtxt):
|
||||
p, _out, err = run_ocrmypdf(
|
||||
p, out, err = run_ocrmypdf(
|
||||
resources / 'trivial.pdf',
|
||||
os.devnull,
|
||||
'-',
|
||||
'--output-type=none',
|
||||
'--sidecar',
|
||||
outtxt,
|
||||
@@ -926,4 +926,3 @@ def test_outputtype_none(resources, outtxt):
|
||||
'tests/plugins/tesseract_noop.py',
|
||||
)
|
||||
assert p.returncode == ExitCode.ok
|
||||
assert outtxt.exists()
|
||||
|
||||
Reference in New Issue
Block a user