question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change deprecation mechanism to use a function

See original GitHub issue

As discussed in https://github.com/pytest-dev/pytest/pull/7362#issuecomment-649800119_, let’s change our warnings mechanism to include a new PytestExpiredDeprecationWarning exception which is chosen at runtime depending on the current pytest version.

This will simplify our side because we won’t need to change PytestDeprecationWarnings into errors anymore before each major release.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
graingertcommented, Aug 21, 2020

Remember the stacklevel for warnings.warn:

def deprecated(reason: str, *, due: int, stacklevel=0):
    stacklevel = stacklevel + 1
    if due >= pytest version [0]:
        warnings.warn(PytestExpiredDeprecationWarning(reason), stacklevel=stacklevel)
    else:
        warnings.warn(PytestDeprecationWarning(reason), stacklevel=stacklevel)
0reactions
RonnyPfannschmidtcommented, Aug 22, 2020

based on experiences in pip and a few internal tools, the self version dependency seems orders of magnitude better than any manually managed way to deal with it

Read more comments on GitHub >

github_iconTop Results From Across the Web

How and When to Deprecate APIs - Oracle Help Center
Java supports two mechanisms for deprecation: and an annotation, (supported starting with J2SE 5.0) and a Javadoc tag (supported since 1.1). Existing calls...
Read more >
python - lint usages of functions with @deprecated decorator
I will get a runtime warning when running it as PYTHONWARNINGS="default::DeprecationWarning" python testfile.py but pylint , mypy , and flake8 ...
Read more >
How to deprecate classes, methods, arguments and hooks in ...
Add the property $deprecatedPublicMethods to the class and list all methods that should no longer be accessed from outside of the class. Make ......
Read more >
Python deprecation - DEV Community ‍ ‍
Deprecation on function arguments, requires you to check for your desired changes and throw DeprecationWarning 's withing the method. from ...
Read more >
API — Deprecated 1.2.14 documentation - Read the Docs
This adapter is used to get the deprecation message according to the wrapped object type: class, function, standard method, static method, or class...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found