Tests(cli): Add coverage for helper functions
Summary
This PR is tests‑only; it adds coverage but introduces no functional changes.
Add unit tests for three un-covered helpers in src/mcp/cli/cli.py
- _parse_file_path (valid / invalid specs)
- _build_uv_command (minimal and “editable + packages” cases)
- _get_npx_command (POSIX and Windows code paths)
Resulting coverage:
- CLI module: 17 % → ~34 %
- Overall project: 88 % → 89 % (measured locally with
pytest --cov)
No production code touched.
Motivation and Context
The CLI is the primary entry-point for MCP users but previously had few tests, so regressions could slip in unnoticed.
These focused unit tests provide a safety net while keeping the codebase lean.
How Has This Been Tested?
- Ran locally on macOS and ran ruff linting/formatting.
uv run pytest uv run pyright uv run ruff check . uv run ruff format .
Breaking Changes
No.
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation update
Checklist
- [x] I have read the MCP Documentation
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [x] I have added appropriate error handling
- [x] I have added or updated documentation as needed
Additional context
Target branch: main per CONTRIBUTING guidelines (house-keeping / tests, not a released-version bug-fix).
Happy to address any feedback or add more coverage if requested.
@dsp-ant Hi David! This PR adds tests for the CLI.
I’ve just rebased onto main and all checks passed.
Let me know if you’d like any tweaks. Happy to add tests or adjust.
Thanks for your time!