Skip to content

Difficulty suppressing deprecation warnings #9616

Answered by The-Compiler
jaraco asked this question in Q&A
Discussion options

You must be logged in to vote

From the changelog:

#7480: A deprecation scheduled to be removed in a major version X (e.g. pytest 7, 8, 9, …) now uses warning category PytestRemovedInXWarning, a subclass of PytestDeprecationWarning, instead of PytestDeprecationWarning directly.

So I'm assuming you could use PytestDeprecationWarning as category filter instead.

Tangentially related, the use of a version number in a deprecation warning seems like a bad idea to me. It (a) requires a new exception for each major version, and (b) more importantly, it commits the project to deprecating this set of functionality in a particular pytest version.

I don't think anyone would mind if a deprecation gets postponed. FWIW Django use…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jaraco
Comment options

jaraco Feb 5, 2022
Collaborator Author

Answer selected by jaraco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants