[Test Improver] test: add error-handling and display-variation tests for view command#1100
Draft
danielmeppiel wants to merge 1 commit intomainfrom
Draft
[Test Improver] test: add error-handling and display-variation tests for view command#1100danielmeppiel wants to merge 1 commit intomainfrom
danielmeppiel wants to merge 1 commit intomainfrom
Conversation
Add 7 new tests for previously uncovered paths in view.py: - _display_marketplace_plugin: marketplace not found (ValueError), MarketplaceFetchError, plugin not found - _display_marketplace_plugin: str source, plugin with tags, plugin without version/description - display_package_info: unexpected OSError exits with code 1 Tests: 41 passed (was 34) 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
Cover 7 previously untested code paths in
src/apm_cli/commands/view.pythat handle error conditions and display variations in_display_marketplace_pluginanddisplay_package_info.Approach
Added tests to
tests/unit/test_view_command.pyin two new test classes:TestDisplayMarketplacePluginErrors(6 tests):test_marketplace_not_found_exits_1-get_marketplace_by_nameraisesValueError-> exit 1test_marketplace_fetch_error_exits_1-fetch_or_cacheraisesMarketplaceFetchError-> exit 1test_plugin_not_found_exits_1- plugin absent from manifest -> exit 1test_plugin_with_str_source_displays-sourceis a plain string, renders correctlytest_plugin_with_tags_displays- plugintagslist appears in outputtest_plugin_without_version_or_description- minimal plugin renders without optional fieldsTestDisplayPackageInfoErrors(1 test):test_package_info_read_failure_exits_1-_get_detailed_package_inforaisesOSError-> exit 1 + error message shownCoverage Impact
These are error-handling and conditional-display paths that previously had zero test coverage. The error paths are particularly valuable because they verify that bad marketplace configs fail fast with clear messages instead of crashing silently.
Trade-offs
_force_rich_fallback,_chdir_tmp) already used in the file.Test Status
Lint:
ruff checkandruff format --checkboth pass clean.Reproducibility
Note
🔒 Integrity filter blocked 17 items
The following items were blocked because they don't meet the GitHub integrity level.
list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: