-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Change pytest deprecation warnings into errors for 6.0 release #7362
Change pytest deprecation warnings into errors for 6.0 release #7362
Conversation
I didn't know that this is how we handle deprecations (I assume it's: change So there are actually a few other deprecations which will only be added in 6.0.x and I suppose require the same treatment:
|
I would like to propose introducing a deprecation helper similar to pip, where declaring a deprecation picks the warning /error class based on the current release and the removed_at parameter |
Exactly, that's what we have been doing since 4.0 and onward. 👍
Ahh thanks for catching those! 👍
You mean the one implemented here? https://github.com/pypa/pip/blob/master/src/pip/_internal/utils/deprecation.py#L62 Looks nice, but for pytest we often remove the warning-generating code together with the error message in X.1 releases: for example, in the past we removed deprecated functions (like |
@RonnyPfannschmidt gentle ping. 😁 We might also change the deprecation mechanism past 6.0. |
@nicoddemus basically having a deprecation helper that goes by version_removed, we remove the need to have one release behave special and making the warning a error, instead the deprecations trigger at the intended release (it makes pushing deprecations up to specific releases and also potentially working with calver much more fun |
I believe you mean this bit:
My question is: under the current system we have, 6.0 users can turn those errors back into warnings (or even to ignore them) as a stop gap until 6.1 is released, at which point the feature and the warning will be effectively removed. IIUC, in the proposed change this will not be possible anymore, because we will bypass the Full disclosure: I'm OK with changing the current mechanism, just wanted to make sure I'm understanding the proposal correctly. |
In the project where we adapted this for work we used warnings.warn and added a filter, the filter just also needed to be installed in a pytest hook to manage the warning capture systems |
Installing a filter is what we do now to change those warnings into errors... unfortunately I'm still not grasping the core of your proposal, sorry. 😕 To recap, here's what we have today (using
So it is not yet clear to me if the new proposal would keep the overall workflow above working, or change it to something else. |
what i want to propose is to introduce a |
Ahh OK I think I got it, thanks! We would then have a function like this:
And then we configure the default filters to always show |
i would use the function to create the warnings/unformulated warnings that later on get passed into warnings.warn |
Got it. 👍 But all this I believe is best done in 6.1 and onward, I wouldn't like to change how deprecations are handled internally and exposed to users before a major release. What do you think? |
They were introduced near 6.0 release where we turn deprecation warnings into errors, so we need to turn those warnings off until 6.1. Related to pytest-dev#7361
…ARNING_CAPTURED_HOOK
b3ae807
to
90d5433
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sphinx has a good mechanism: https://www.sphinx-doc.org/en/master/internals/release-process.html
@RonnyPfannschmidt @hugovk gentle ping. 😁 |
Co-authored-by: Hugo van Kemenade <[email protected]>
I believe this is the last PR required for 6.0. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely missed that this PR was updated. LGTM.
@RonnyPfannschmidt: I updated some tests which didn't use
from_parent
.@bluetech: I had to suppress the MINUS_K_COLON and MINUS_K_DASH warnings because they would turn into errors in 6.0, and we want to make them into errors in 7.0 only, given they were added too recently; we should reintroduce the warnings in 6.1 ( (#7361).
Closes #5584