Skip to content

Add test coverage for the nflow CLI - #12

Open
Anilreddy2309 wants to merge 1 commit into
NVIDIA:mainfrom
Anilreddy2309:test/cli-coverage
Open

Add test coverage for the nflow CLI#12
Anilreddy2309 wants to merge 1 commit into
NVIDIA:mainfrom
Anilreddy2309:test/cli-coverage

Conversation

@Anilreddy2309

Copy link
Copy Markdown

Summary

nvflow/cli/main.py (the list-stages, run, run-all, validate, stage-info commands) had zero dedicated test coverage. tests/test_cli_cmd.py tests a different module (nvflow/lib/cli_cmd.py, a shell-command builder) with a similarly-named file — easy to mistake for CLI coverage, but it isn't.

This PR adds tests/test_cli_main.py, using typer.testing.CliRunner against the real Typer app and the real auto-discovered stage registry (via the example recipe, which needs none of the heavy nemo-skills/torch stack, so it registers correctly even in the CI-lightweight test environment described in tests/requirements-ci.txt).

Coverage:

  • version
  • list-stages: no args, --recipe, unknown recipe, unknown workflow, --config, missing config file
  • stage-info: full path, short name + --recipe/--workflow, short name missing those options, invalid path format, unknown stage
  • validate: valid config, missing config file, missing --config option
  • run / run-all: missing config file, missing --config option

Also adds typer to tests/requirements-ci.txt — without it, this test file can't even be collected in the lightweight CI environment (nvflow.cli.main imports typer directly), so this was necessary for the new tests to actually run in CI rather than error at collection.

Test plan

  • ruff check / ruff format --check pass
  • mypy passes on the new file
  • New suite passes (18/18) against the real CLI in an environment mirroring the exact CI install (pip install -e . --no-deps + tests/requirements-ci.txt, no nemo-skills/torch)
  • Full existing pytest tests/ suite still passes (371 passed, 3 pre-existing skips, unrelated to this change) in the same environment -- confirms no regression

🤖 Generated with Claude Code

…ate, stage-info)

nvflow/cli/main.py had zero dedicated test coverage -- tests/test_cli_cmd.py
tests a different module (nvflow/lib/cli_cmd.py, a shell-command builder)
with a similarly-named file, which is easy to mistake for CLI coverage.

Add tests/test_cli_main.py using typer.testing.CliRunner, exercised against
the real auto-discovered stage registry via the `example` recipe (which
needs none of the heavy nemo-skills/torch stack, so it registers even in
the CI-lightweight test environment). Covers the happy path and the main
error paths for each command: unknown recipe/workflow/stage, invalid
stage-info path formats, and missing config files.

Add `typer` to tests/requirements-ci.txt so this file is actually collected
and run in CI rather than silently needing typer at collection time with
nothing to provide it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Anil Balireddy <anilbalireddi@gmail.com>
@Anilreddy2309
Anilreddy2309 requested a review from a team September 11, 2026 16:56
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.

1 participant