fix: correct Fore.reset typo crashing update error handler - #494
Merged
Conversation
kaifcodec
approved these changes
Aug 3, 2026
kaifcodec
left a comment
Owner
There was a problem hiding this comment.
LGTM @A-S-Manoj.
And thanks for the test update.
Contributor
Author
|
Appreciate the quick review. |
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.
Fixes #493
Problem
update_self()'s error handler usesFore.reset(lowercase), which doesn't exist on colorama'sForeclass (onlyFore.RESETdoes). Whenpip installfails afterpip uninstallhas already succeeded, the warning meant to tell the user the tool is now uninstalled crashes instead withAttributeError: 'AnsiFore' object has no attribute 'reset', leaving them with a raw traceback and no indication of what happened.Fix
Changed
Fore.resettoFore.RESETon the affected line.Changes
user_scanner/utils/update.py— one-character fixtests/test_update.py— added a regression test that mocks uninstall succeeding and install failing with a realsubprocess.CalledProcessError, and asserts the error message prints without raisingTesting
Confirmed the new test fails on unmodified code with the exact real
AttributeError, and passes with the fix. Full suite: 173 passed, 3 skipped (pre-existing, unrelated) against currentmain.ruff check .andmypy user_scannerboth clean.