diff --git a/backend/tests/test_submission.py b/backend/tests/test_submission.py index f2a56ce..71956f5 100644 --- a/backend/tests/test_submission.py +++ b/backend/tests/test_submission.py @@ -196,13 +196,19 @@ def test_submit_file_uses_default_paramiko_factory(monkeypatch): def test_submit_batch_cli_help(): - """`cyclone submit-batch --help` exits 0 and shows the flags.""" - import subprocess - import sys - result = subprocess.run( - [sys.executable, "-m", "cyclone.cli", "submit-batch", "--help"], - capture_output=True, text=True, - cwd=str(Path(__file__).parent.parent), - ) - assert result.returncode == 0 - assert "--ingest-dir" in result.stdout + """`cyclone submit-batch --help` exits 0 and shows the flags. + + Uses ``click.testing.CliRunner`` instead of ``subprocess.run`` for + ~10ms vs ~200ms per call. Same assertions — the CliRunner + ``result.exit_code`` matches the subprocess returncode, and + ``result.output`` is the Click-rendered help text (subprocess's + stdout). + """ + from click.testing import CliRunner + + from cyclone.cli import main + + runner = CliRunner() + result = runner.invoke(main, ["submit-batch", "--help"]) + assert result.exit_code == 0, result.output + assert "--ingest-dir" in result.output