Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stacklevel 2 warnings #226

Merged
merged 1 commit into from Sep 30, 2021
Merged

stacklevel 2 warnings #226

merged 1 commit into from Sep 30, 2021

Conversation

wimglenn
Copy link
Contributor

Use stacklevel=2 for deprecation warnings, so the source/line number of user code is indicated, instead of the source/line of the library itself.

$ cat user_code.py 
# in user_code.py
from cachetools.ttl import TTLCache

With this:

python3 -Wall user_code.py
/Users/wim/git/cachetools/user_code.py:2: DeprecationWarning: cachetools.ttl is deprecated, please use cachetools.TTLCache
  from cachetools.ttl import TTLCache

Without this:

$ python3 -Wall user_code.py
/Users/wim/git/cachetools/src/cachetools/ttl.py:5: DeprecationWarning: cachetools.ttl is deprecated, please use cachetools.TTLCache
  warnings.warn(

@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2021

Codecov Report

Merging #226 (d2297fe) into master (8b9bbc4) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #226   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          556       556           
=========================================
  Hits           556       556           
Impacted Files Coverage Δ
src/cachetools/cache.py 100.00% <ø> (ø)
src/cachetools/fifo.py 100.00% <ø> (ø)
src/cachetools/lfu.py 100.00% <ø> (ø)
src/cachetools/lru.py 100.00% <ø> (ø)
src/cachetools/mru.py 100.00% <ø> (ø)
src/cachetools/rr.py 100.00% <ø> (ø)
src/cachetools/ttl.py 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b9bbc4...d2297fe. Read the comment docs.

@tkem tkem merged commit a05b686 into tkem:master Sep 30, 2021
@wimglenn wimglenn deleted the stacklevel-2 branch October 1, 2021 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants