-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Review backward compatibility policy #3983
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ src/_pytest/_version.py | |
| .eggs/ | ||
|
|
||
| doc/*/_build | ||
| doc/*/.doctrees | ||
| build/ | ||
| dist/ | ||
| *.egg-info | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,14 +7,14 @@ Keeping backwards compatibility has a very high priority in the pytest project. | |
|
|
||
| With the pytest 3.0 release we introduced a clear communication scheme for when we will actually remove the old busted joint and politely ask you to use the new hotness instead, while giving you enough time to adjust your tests or raise concerns if there are valid reasons to keep deprecated functionality around. | ||
|
|
||
| To communicate changes we are already issuing deprecation warnings, but they are not displayed by default. In pytest 3.0 we changed the default setting so that pytest deprecation warnings are displayed if not explicitly silenced (with ``--disable-pytest-warnings``). | ||
| To communicate changes we issue deprecation warnings using a custom warning hierarchy (see :ref:`internal-warnings`). These warnings may be suppressed using the standard means: ``-W`` command-line flag or ``filterwarnings`` ini options (see :ref:`warnings`), but we suggest to use these sparingly and temporarily, and heed the warnings when possible. | ||
|
|
||
| We will only remove deprecated functionality in major releases (e.g. if we deprecate something in 3.0 we will remove it in 4.0), and keep it around for at least two minor releases (e.g. if we deprecate something in 3.9 and 4.0 is the next release, we will not remove it in 4.0 but in 5.0). | ||
| We will only start the removal of deprecated functionality in major releases (e.g. if we deprecate something in 3.0 we will start to remove it in 4.0), and keep it around for at least two minor releases (e.g. if we deprecate something in 3.9 and 4.0 is the next release, we start to remove it in 5.0, not in 4.0). | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@RonnyPfannschmidt because of this requirement, I think we should after When we deprecate something we don't know exactly when the next major release will be. This makes it hard to track which of the functionalities marked with To avoid this problem, here's what I propose: We add a The more we refactor the internal code and improve the API, the more I see getting a very tight and consistent deprecation process is important to avoid disrupting our users. Please let me know your thoughts. 😁
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Very good - I think that would make it much clearer. One suggestion: how about naming the parameter in a clearer way, that even the casual source code reader knows what it is about. Something like If the docstring for the deprecation would also contain the "rules" then, this would be clear as day - e.g. class PytestDeprecationWarning(PytestWarning, DeprecationWarning):
"""
[Same stuff as before]
Removals only happen in major releases, after a deprecation warning has been emitted for at least two minor versions.
"""Don't know if this is the best way to phrase it, but I hope you get my drift.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All around good suggestions. 👍 |
||
|
|
||
| When the deprecation expires (e.g. 4.0 is released), we won't remove the deprecated functionality immediately, but will use the standard warning filters to turn them into **errors** by default. This approach makes it explicit that removal is imminent, and still gives you time to turn the deprecated feature into a warning instead of an error so it can be dealt with in your own time. In the next minor release (e.g. 4.1), the feature will be effectively removed. | ||
|
|
||
|
|
||
| Deprecation Roadmap | ||
| ------------------- | ||
|
|
||
| We track deprecation and removal of features using milestones and the `deprecation <https://github.com/pytest-dev/pytest/issues?q=label%3A%22type%3A+deprecation%22>`_ and `removal <https://github.com/pytest-dev/pytest/labels/type%3A%20removal>`_ labels on GitHub. | ||
|
|
||
| Following our deprecation policy, after starting issuing deprecation warnings we keep features for *at least* two minor versions before considering removal. | ||
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.
Much more informative like that, even with a touch of philosophy about how to deal with warnings.
Just a question about
--disable-pytest-warningsis this planned to be phased out then and be replaced with the standard means? I just ran a test with newest pytest using that flag and did at least not get a deprecation warning for it. If we don't need this anymore all the better - the amount of command line options for pytest is staggeringly vast, so a bit of pruning would not hurt :)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 remove the mention about
--disable-pytest-warningsbecause when this was written, it only suppressed pytest's own internal warnings. The standard warnings plugin was even introduced yet at the time.Now
--disable-pytest-warningsis an alias to--disable-warnings, which disables the entire warning summary (internal and external warnings). I thought I would remove it from here as it no longer is deprecation-specific, and mentioning the warning filters seems more productive as it is a more flexible and generic mechanism.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.
Makes perfect sense. So this alias could then be deprecated, I guess :)