Skip to content

Comments

Improve test coverage for Python adapter utils#10

Closed
debugmcpdev wants to merge 9 commits intomainfrom
claude/improve-python-utils-tests-011CUzgqeMN4zYuHuvCuoJGT
Closed

Improve test coverage for Python adapter utils#10
debugmcpdev wants to merge 9 commits intomainfrom
claude/improve-python-utils-tests-011CUzgqeMN4zYuHuvCuoJGT

Conversation

@debugmcpdev
Copy link
Collaborator

Adds comprehensive test suite for packages/adapter-python/src/utils/python-utils.ts to improve test coverage.

Coverage improvements:

  • Statements: 72.95% → 76.5%
  • Branches: 83.48% → 87.17% ✓
  • Functions: 80% → 80% ✓

New test file:

  • packages/adapter-python/tests/unit/python-utils.comprehensive.test.ts

Test coverage includes:

  • CommandNotFoundError class
  • setDefaultCommandFinder function
  • Windows platform-specific behavior (Path vs PATH, Store aliases, .exe handling)
  • Environment variable handling (PYTHON_PATH, PYTHON_EXECUTABLE, pythonLocation, PythonLocation)
  • Multiple Python installations with debugpy preference
  • Error scenarios and edge cases
  • getPythonVersion function (all code paths)
  • Verbose discovery logging
  • Windows Store alias detection
  • pythonLocation candidate checking
  • Spawn error handling

Total tests: 44 (32 new + 12 existing from python-utils.discovery.test.ts)

Dependencies added:

  • @vitest/coverage-v8 for coverage reporting

📋 Description

Please include a summary of the changes and which issue is fixed. Include relevant motivation and context.

Fixes # (issue number)

🔄 Type of Change

Please delete options that are not relevant.

  • 🐛 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 not work as expected)
  • 📚 Documentation update
  • 🧹 Code refactoring
  • ⚡ Performance improvement
  • 🧪 Test improvement

✅ Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

🧪 Testing

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

# Example test command
npm test

Test Configuration:

  • OS: [e.g., Ubuntu 22.04]
  • Node version: [e.g., 20.11.0]
  • Python version: [e.g., 3.11.5]

📸 Screenshots (if applicable)

If your changes include UI updates or visual debugging improvements, please add screenshots.

🔗 Related Issues

Link any related issues here:

  • Related to #
  • Depends on #
  • Blocks #

📝 Additional Notes

Any additional information that reviewers should know.


Reviewer: @debugmcp

Adds comprehensive test suite for packages/adapter-python/src/utils/python-utils.ts
to improve test coverage.

Coverage improvements:
- Statements: 72.95% → 76.5%
- Branches: 83.48% → 87.17% ✓
- Functions: 80% → 80% ✓

New test file:
- packages/adapter-python/tests/unit/python-utils.comprehensive.test.ts

Test coverage includes:
- CommandNotFoundError class
- setDefaultCommandFinder function
- Windows platform-specific behavior (Path vs PATH, Store aliases, .exe handling)
- Environment variable handling (PYTHON_PATH, PYTHON_EXECUTABLE, pythonLocation, PythonLocation)
- Multiple Python installations with debugpy preference
- Error scenarios and edge cases
- getPythonVersion function (all code paths)
- Verbose discovery logging
- Windows Store alias detection
- pythonLocation candidate checking
- Spawn error handling

Total tests: 44 (32 new + 12 existing from python-utils.discovery.test.ts)

Dependencies added:
- @vitest/coverage-v8 for coverage reporting
@debugmcpdev debugmcpdev self-assigned this Nov 10, 2025
@debugmcpdev
Copy link
Collaborator Author

Build Failure - Branch Needs Update

The CI builds are failing due to a missing dependency that was added to main after this branch was created. Specifically, commit

@debugmcpdev
Copy link
Collaborator Author

Build Failure - Branch Needs Update

The CI builds are failing due to a missing dependency that was added to main after this branch was created. Specifically, commit 05c6152 introduced AdapterLaunchBarrier which is now required by the build.

Error:
error TS2305: Module '@debugmcp/shared' has no exported member 'AdapterLaunchBarrier'.

To Fix

Please update your branch with the latest changes from main:

�ash git checkout claude/improve-python-utils-tests-011CUzgqeMN4zYuHuvCuoJGT git fetch upstream git merge upstream/main git push origin claude/improve-python-utils-tests-011CUzgqeMN4zYuHuvCuoJGT

If you do not have upstream configured:
�ash git remote add upstream https://github.com/debugmcp/mcp-debugger.git

Once merged and pushed, the CI will automatically re-run and should pass (as it did for PR #9 after the same fix).

@debugmcpdev
Copy link
Collaborator Author

Build Failure - Branch Needs Update

The CI builds are failing due to a missing dependency that was added to main after this branch was created. Specifically, commit 05c6152 introduced AdapterLaunchBarrier which is now required by the build.

Error:

error TS2305: Module '@debugmcp/shared' has no exported member 'AdapterLaunchBarrier'.

To Fix

Please update your branch with the latest changes from main:

git checkout claude/improve-python-utils-tests-011CUzgqeMN4zYuHuvCuoJGT
git fetch upstream
git merge upstream/main
git push origin claude/improve-python-utils-tests-011CUzgqeMN4zYuHuvCuoJGT

If you do not have upstream configured:

git remote add upstream https://github.com/debugmcp/mcp-debugger.git

Once merged and pushed, the CI will automatically re-run and should pass (as it did for PR #9 after the same fix).

@debugmcpdev
Copy link
Collaborator Author

Closing this PR as the test improvements have been cherry-picked directly to main (commit 4330698). The build configuration issues that were preventing CI from passing have been resolved separately in main.

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