[Test Improver] test: add unit tests for MCPIntegrator (0% -> ~75%)#632
Draft
danielmeppiel wants to merge 1 commit intomainfrom
Draft
[Test Improver] test: add unit tests for MCPIntegrator (0% -> ~75%)#632danielmeppiel wants to merge 1 commit intomainfrom
danielmeppiel wants to merge 1 commit intomainfrom
Conversation
Cover pure-logic methods: deduplicate, get_server_names, get_server_configs, _append_drifted_to_install_list, _detect_mcp_config_drift, _detect_runtimes, _build_self_defined_info, _apply_overlay, update_lockfile, remove_stale (vscode + copilot), and collect_transitive edge cases. 70 new tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Test Improver — automated AI assistant
Goal and Rationale
MCPIntegrator(src/apm_cli/integration/mcp_integrator.py, 1395 lines) is a large, high-risk orchestrator with zero dedicated tests. It owns MCP dependency resolution, deduplication, server-info building, drift detection, runtime detection, lockfile persistence, and stale cleanup across five runtimes (VS Code, Copilot, Codex, Cursor, OpenCode).Bugs here could silently corrupt MCP configuration files across all runtimes. This PR adds focused unit tests for every pure-logic method.
Approach
Tests target the methods that can be verified without live runtimes or network:
TestIsVscodeAvailable_is_vscode_available()— PATH + dir detectionTestDeduplicatededuplicate()— first-wins, dict/str/nameless entries, orderingTestGetServerNamesget_server_names()— dep objects, strings, mixedTestGetServerConfigsget_server_configs()— serialization, plain-string fallbackTestAppendDrifted_append_drifted_to_install_list()— sorted append, dedupTestDetectMcpConfigDrift_detect_mcp_config_drift()— changed/unchanged/new configsTestDetectRuntimes_detect_runtimes()— word-boundary regex, multi-runtimeTestBuildSelfDefinedInfo_build_self_defined_info()— stdio, http/sse, env, args, headers, toolsTestApplyOverlay_apply_overlay()— transport, package filter, headers, args (list+dict), tools, warningTestUpdateLockfileupdate_lockfile()— temp file writes, sorted servers, empty clearTestRemoveStaleVscoderemove_stale()— server removal, short-name matching, runtime targetingTestRemoveStaleCopilotremove_stale()— copilot config cleanupTestCollectTransitivecollect_transitive()— missing/empty dir edge casesCoverage Impact
mcp_integrator.pycoverageTest Status
All 70 new tests pass. Full unit suite passes with no regressions.
Reproducibility