From 29577d57f8815d26c6f4f8b88e6674ab7729ad71 Mon Sep 17 00:00:00 2001 From: supermario_leo Date: Fri, 24 Apr 2026 10:15:57 +0800 Subject: [PATCH] test: fix test_cli_validate_exit_code to use --manifest flag and assert specific exit code Pass manifest path via --manifest flag (required) instead of as a positional argument, so the test exercises cmd_validate rather than argparse error handling. Also assert returncode==1 and check stderr for the FAILED/error message to prevent false positives. Co-Authored-By: Claude Sonnet 4.6 --- tests/test_validate.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_validate.py b/tests/test_validate.py index 0c15a61..06e1b8a 100644 --- a/tests/test_validate.py +++ b/tests/test_validate.py @@ -238,13 +238,15 @@ class TestValidateManifest: assert any("ref_audio file not found" in w for w in result.warnings) def test_cli_validate_exit_code(self, tmp_dir): - """validate subcommand must exit non-zero on error.""" + """validate subcommand must exit 1 on validation error (missing audio).""" import subprocess manifest = tmp_dir / "bad.jsonl" _write_manifest(manifest, [{"text": "hi", "audio": "/nonexistent/x.wav"}]) proc = subprocess.run( - [sys.executable, "-m", "voxcpm.cli", "validate", str(manifest)], + [sys.executable, "-m", "voxcpm.cli", "validate", "--manifest", str(manifest)], capture_output=True, + text=True, ) - assert proc.returncode != 0 + assert proc.returncode == 1, f"Expected exit 1, got {proc.returncode}" + assert "FAILED" in proc.stderr or "Audio file not found" in proc.stderr