Difficulty suppressing deprecation warnings #9616
-
In jaraco/skeleton#57, I collected four different issues that pytest 7 introduced in the plugins I use across my projects. In one of the plugins, I fixed the issue promptly, because I own it. In the others, I expect slower progress, so I've attempted to suppress the DeprecationWarnings by adding to the pytest config (jaraco/skeleton@8949d1a). Unfortunately, I realized later that it's not possible to specify the warning category on Pytest 6 because it doesn't exist yet. As a result, all of my projects are now currently incompatible with pytest prior to version 7. I'm not sure how to handle this situation. I can think of some options, none of which are great:
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 agree it's nice to have some predictability and visibility into the roadmap for pytest, but I've been bitten in the past by anticipating a version in which a change will occur only to find that that change didn't occur or couldn't occur as predicted, so the advertisement becomes false. I'd advise instead to commit to a minimum lifetime for a deprecated feature (e.g. 6 months), perhaps aligned with the anticipated release cadence, but not commit specifically to removing it until the code is actually removed. Back to my original problem, this issue would have been easier to deal with if a general warning category had been used, one that's been around for some time (either in the stdlib or in pytest). Do you have any better ideas than the ones described above for addressing this concern? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
From the changelog:
So I'm assuming you could use
I don't think anyone would mind if a deprecation gets postponed. FWIW Django uses the same system we do, and I think I've seen it in many other projects too. |
Beta Was this translation helpful? Give feedback.
From the changelog:
So I'm assuming you could use
PytestDeprecationWarning
as category filter instead.I don't think anyone would mind if a deprecation gets postponed. FWIW Django use…