diff --git a/tests/conftest.py b/tests/conftest.py index 004d91df..31b5941f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,7 +12,7 @@ import pytest from ocrmypdf import api, pdfinfo from ocrmypdf._exec import unpaper -from ocrmypdf._plugin_manager import get_parser_options_plugins +from ocrmypdf.cli import get_options_and_plugins from ocrmypdf.exceptions import ExitCode @@ -84,7 +84,7 @@ def check_ocrmypdf(input_file: Path, output_file: Path, *args) -> Path: str(arg) for arg in args if arg is not None ] - _parser, options, plugin_manager = get_parser_options_plugins(args=api_args) + options, plugin_manager = get_options_and_plugins(args=api_args) api.check_options(options, plugin_manager) result = api.run_pipeline(options, plugin_manager=plugin_manager) @@ -108,7 +108,7 @@ def run_ocrmypdf_api(input_file: Path, output_file: Path, *args) -> ExitCode: api_args = [str(input_file), str(output_file)] + [ str(arg) for arg in args if arg is not None ] - _parser, options, plugin_manager = get_parser_options_plugins(args=api_args) + options, plugin_manager = get_options_and_plugins(args=api_args) api.check_options(options, plugin_manager) return api.run_pipeline_cli(options, plugin_manager=plugin_manager) diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 376afecc..0092b602 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -15,7 +15,8 @@ from pikepdf.models.metadata import decode_pdf_date from ocrmypdf._jobcontext import PdfContext from ocrmypdf._metadata import metadata_fixup from ocrmypdf._pipeline import convert_to_pdfa -from ocrmypdf._plugin_manager import get_parser_options_plugins, get_plugin_manager +from ocrmypdf._plugin_manager import get_plugin_manager +from ocrmypdf.cli import get_options_and_plugins from ocrmypdf.exceptions import ExitCode from ocrmypdf.pdfa import file_claims_pdfa, generate_pdfa_ps from ocrmypdf.pdfinfo import PdfInfo @@ -323,7 +324,7 @@ def test_kodak_toc(resources, outpdf): def test_metadata_fixup_warning(resources, outdir, caplog): - _parser, options, _pm = get_parser_options_plugins( + options, _pm = get_options_and_plugins( ['--output-type', 'pdfa-2', 'graph.pdf', 'out.pdf'] ) @@ -367,7 +368,7 @@ def test_prevent_gs_invalid_xml(resources, outdir): ) pdf.save(outdir / 'layers.rendered.pdf', fix_metadata_version=False) - _, options, _ = get_parser_options_plugins( + options, _ = get_options_and_plugins( args=[ '-j', '1', diff --git a/tests/test_unpaper.py b/tests/test_unpaper.py index 952cc33a..9319a97e 100644 --- a/tests/test_unpaper.py +++ b/tests/test_unpaper.py @@ -11,7 +11,7 @@ import pytest from packaging.version import Version from ocrmypdf._exec import unpaper -from ocrmypdf._plugin_manager import get_parser_options_plugins +from ocrmypdf.cli import get_options_and_plugins from ocrmypdf._validation import check_options from ocrmypdf.exceptions import BadArgsError, ExitCode, MissingDependencyError @@ -26,7 +26,7 @@ def test_no_unpaper(resources, no_outpdf): input_ = fspath(resources / "c02-22.pdf") output = fspath(no_outpdf) - _parser, options, pm = get_parser_options_plugins(["--clean", input_, output]) + options, pm = get_options_and_plugins(["--clean", input_, output]) with patch("ocrmypdf._exec.unpaper.version") as mock: mock.side_effect = FileNotFoundError("unpaper") @@ -39,7 +39,7 @@ def test_old_unpaper(resources, no_outpdf): input_ = fspath(resources / "c02-22.pdf") output = fspath(no_outpdf) - _parser, options, pm = get_parser_options_plugins(["--clean", input_, output]) + options, pm = get_options_and_plugins(["--clean", input_, output]) with patch("ocrmypdf._exec.unpaper.version") as mock: mock.return_value = Version('0.5') @@ -52,7 +52,7 @@ def test_unpaper_version_chatter(resources, no_outpdf): input_ = fspath(resources / "c02-22.pdf") output = fspath(no_outpdf) - _parser, options, pm = get_parser_options_plugins(["--clean", input_, output]) + options, pm = get_options_and_plugins(["--clean", input_, output]) with patch("ocrmypdf.subprocess.run") as mock: mock.return_value = Mock(stdout='Warning: using insecure memory!\n7.0.0\n')