Skip to content

test(mcp): validate install_mcp OSError path exits with code 1#4

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/review-pr-3-code
Draft

test(mcp): validate install_mcp OSError path exits with code 1#4
Copilot wants to merge 2 commits intomainfrom
copilot/review-pr-3-code

Conversation

Copy link

Copilot AI commented Feb 26, 2026

PR #3 added a test for the OSError handling branch in install_mcp() but used a brittle string-suffix check to target the config file. Applied the PR with one improvement.

Changes

  • tests/test_codeclaw_cli_mcp.py
    • Added import pytest (required for pytest.raises)
    • Added test_install_mcp_handles_read_oserror: monkeypatches Path.read_text to raise OSError for the specific config path and asserts SystemExit(1)
    • Fixed path matching from str(self).endswith("mcp.json")self == config_path to prevent false matches on unrelated files
def mock_read_text(self, *args, **kwargs):
    if self == config_path:          # precise: was str(self).endswith("mcp.json")
        raise OSError("Fake OS Error")
    return original_read_text(self, *args, **kwargs)

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: ychampion <68075205+ychampion@users.noreply.github.com>
Copilot AI changed the title [WIP] Review code changes in pull request #3 test(mcp): validate install_mcp OSError path exits with code 1 Feb 26, 2026
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