Skip to content

fix: removed-flag test exits for missing args, not the flag - #67

Merged
oliverholworthy merged 1 commit into
NVIDIA-NeMo:mainfrom
andrewwhitecdw:bugfix/test-cli-removed-flag-test-exits-for-missing
Aug 18, 2026
Merged

oliverholworthy merged 1 commit into
NVIDIA-NeMo:mainfrom
andrewwhitecdw:bugfix/test-cli-removed-flag-test-exits-for-missing

Conversation

@andrewwhitecdw

Copy link
Copy Markdown
Contributor

This PR addresses the following issue in plugins/data-designer-retrieval-sdg/tests/test_cli.py: removed-flag test exits for missing args, not the flag.

Changes

  • plugins/data-designer-retrieval-sdg/tests/test_cli.py: removed-flag test exits for missing args, not the flag.

Details

--- a/plugins/data-designer-retrieval-sdg/tests/test_cli.py
+++ b/plugins/data-designer-retrieval-sdg/tests/test_cli.py
@@ -1,22 +1,13 @@
-@pytest.mark.parametrize("removed_flag", ["--batch-size", "--start-batch-index", "--end-batch-index"])
-def test_generate_rejects_removed_batch_flags(
-    monkeypatch: pytest.MonkeyPatch,
-    tmp_path: Path,
-    removed_flag: str,
-) -> None:
-    argv = [
-        "data-designer-retrieval-sdg",
-        "generate",
-        "--input-dir",
-        str(tmp_path),
-        "--output-dir",
-        str(tmp_path / "out"),
-        removed_flag,
-        "1",
-    ]
-    monkeypatch.setattr(sys, "argv", argv)
-
-    with pytest.raises(SystemExit) as exc_info:
-        cli.main()
-
-    assert exc_info.value.code == 2
+@pytest.mark.parametrize("removed_flag", ["--batch-size", "--start-batch-index", "--end-batch-index"])
+def test_generate_rejects_removed_batch_flags(
+    monkeypatch: pytest.MonkeyPatch,
+    tmp_path: Path,
+    removed_flag: str,
+) -> None:
+    monkeypatch.setattr(cli, "run_generation", lambda *_args, **_kwargs: pytest.fail("generation must not start"))
+    monkeypatch.setattr(sys, "argv", generate_argv(tmp_path, extra_args=[removed_flag, "1"]))
+
+    with pytest.raises(SystemExit) as exc_info:
+        cli.main()
+
+    assert exc_info.value.code == 2

Tests

  • plugins/data-designer-retrieval-sdg/tests/test_cli.py
No separate test patch needed; the existing test_generate_rejects_removed_batch_flags test is corrected directly in the patch above.

Signed-off-by: andrewwhitecdw <andrewwhitecdw@users.noreply.github.com>

@oliverholworthy oliverholworthy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tightening this test.

@oliverholworthy
oliverholworthy merged commit bbc9ac9 into NVIDIA-NeMo:main Aug 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants