Skip to content

fix: correct Fore.reset typo crashing update error handler - #494

Merged
kaifcodec merged 1 commit into
kaifcodec:mainfrom
A-S-Manoj:fix-fore-reset-typo
Aug 3, 2026
Merged

fix: correct Fore.reset typo crashing update error handler#494
kaifcodec merged 1 commit into
kaifcodec:mainfrom
A-S-Manoj:fix-fore-reset-typo

Conversation

@A-S-Manoj

Copy link
Copy Markdown
Contributor

Fixes #493

Problem

update_self()'s error handler uses Fore.reset (lowercase), which doesn't exist on colorama's Fore class (only Fore.RESET does). When pip install fails after pip uninstall has already succeeded, the warning meant to tell the user the tool is now uninstalled crashes instead with AttributeError: 'AnsiFore' object has no attribute 'reset', leaving them with a raw traceback and no indication of what happened.

Fix

Changed Fore.reset to Fore.RESET on the affected line.

Changes

  • user_scanner/utils/update.py — one-character fix
  • tests/test_update.py — added a regression test that mocks uninstall succeeding and install failing with a real subprocess.CalledProcessError, and asserts the error message prints without raising

Testing

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 current main. ruff check . and mypy user_scanner both clean.

@kaifcodec kaifcodec left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @A-S-Manoj.
And thanks for the test update.

@kaifcodec kaifcodec added the bug fix Fixed a bug in existing files label Aug 3, 2026
@kaifcodec
kaifcodec merged commit b3bfdde into kaifcodec:main Aug 3, 2026
2 checks passed
@A-S-Manoj

Copy link
Copy Markdown
Contributor Author

Appreciate the quick review.

@A-S-Manoj
A-S-Manoj deleted the fix-fore-reset-typo branch August 3, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Fixed a bug in existing files

2 participants