feat: deprecate the unused CacheError - #224
Merged
Merged
Conversation
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.
Closes #163. Part of #113. Removal is tracked in #130 (0.4.0).
fastapi_cachex.exceptions.CacheErroris never raised anywhere in the package._CacheError(with__name__/__qualname__kept asCacheError) and served through a module-level__getattr__(PEP 562). Bothexceptions.CacheErrorandfrom fastapi_cachex.exceptions import CacheErroremit aDeprecationWarningthat points at the caller's line (stacklevel=2). It is still aCacheXErrorsubclass, soexcept CacheErrorkeeps working.TYPE_CHECKINGalias keepsCacheErrorvisible to type checkers.import fastapi_cachexdoes not trigger the warning (checked with-W error::DeprecationWarning).docs/api/types.mdgets a short deprecation note.### Deprecatedentry. It also removes the blank line between the two existing Deprecated entries, to match the rest of the file.Tests
New
tests/test_exceptions.py: the warning on attribute access (including the caller's filename), onfrom ... import, andAttributeErrorfor unknown names. Mutation checks: removing the warning fails only the two warning tests;stacklevel=1fails only the filename test. Full suite, ruff,mypy --strict, the changelog format test and both--strict --cleandocs builds pass.