[Test Improver] test: expand update command coverage (3 -> 20 tests)#471
Draft
danielmeppiel wants to merge 1 commit intomainfrom
Draft
[Test Improver] test: expand update command coverage (3 -> 20 tests)#471danielmeppiel wants to merge 1 commit intomainfrom
danielmeppiel wants to merge 1 commit intomainfrom
Conversation
Add 17 new tests covering previously untested paths in update.py: - Dev version (unknown) with and without --check returns early - Version fetch failure exits with error - Already on latest version exits cleanly - --check flag reports available update without installing - Installer failure (non-zero exit) shows error and exits 1 - requests ImportError falls back to manual instructions - Download exception shows manual update command - Helper functions: URL, suffix, run-command per platform - Windows pwsh fallback when powershell not found - Unix /bin/sh fallback when /bin/sh absent 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.
🤖 This is an automated PR from Test Improver, an AI assistant focused on improving tests.
Goal and Rationale
update.pyhad only 3 tests covering the happy-path Windows and Unix install flows, leaving 7 distinct code paths completely untested. This PR adds 17 tests to cover the remaining paths, focusing on error conditions and guard logic that could hide real bugs.Approach
Added two new test classes alongside the existing
TestUpdateCommand:TestUpdateHelpers— unit tests for the 4 platform-detection helper functions (_get_update_installer_url,_get_update_installer_suffix,_get_installer_run_command). These are pure functions that are easy to test in isolation.TestUpdateCommand— integration-style tests usingCliRunnerfor the main command paths.Newly covered paths
unknown) without--checkunknown) with--checkNone--checkwhen update is availablerequestsnot importable (ImportError)/bin/shfallbackpwshfallbackCoverage Impact
src/apm_cli/commands/update.pyTrade-offs
patch.object(sys, "platform", ...)consistent with existing tests.Test Status
All 3124 unit tests pass:
Reproducibility