Skip to content

Tests(cli): Add coverage for helper functions #635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davenpi
Copy link

@davenpi davenpi commented May 5, 2025

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

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • 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.

@davenpi davenpi force-pushed the test/cli-coverage-bump branch from 6b85bb9 to c17a743 Compare May 7, 2025 20:38
@davenpi
Copy link
Author

davenpi commented May 7, 2025

@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!

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