You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Change deprecation mechanism to use a function #7480
As discussed in #7362 (comment)_, 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.
I'll be reverting these entries from the CHANGELOG:
- `#6981 <https://github.com/pytest-dev/pytest/issues/6981>`_: Deprecate the ``pytest.collect`` module as it's just aliases into ``pytest``.
- `#7097 <https://github.com/pytest-dev/pytest/issues/7097>`_: The ``pytest._fillfuncargs`` function is now deprecated. This function was kept
for backward compatibility with an older plugin.
It's functionality is not meant to be used directly, but if you must replace
it, use `function._request._fillfixtures()` instead, though note this is not
a public API and may break in the future.
defuse_of_deprecated_thing():
deprecated("don't use this function, use X instead", due=7)
# do its thing
However, because our version depends on the tag of the release, the actual pytest version will stay 6.X until the actual tag 7.0.0 is pushed at release time, and in that moment that function will issue PytestExpiredDeprecationWarning, which will then break the actual release. Any ideas?
This will simplify our side because we won't need to change PytestDeprecationWarnings into errors anymore before each major release.
Is this a major headache? Making things conditional on our own __version__ might cause some headaches of its own...
BTW, Django does something I like, which is embed the removal version in the warning type. This brings clarity to all involved, but might be getting too fancy.
Adapted to pytest (as of version 6.1), this would be:
# Existing classclassPytestDeprecationWarning(PytestWarning, DeprecationWarning): ...
# New classclassPytestExpiredDeprecationWarning(PytestWarning, DeprecationWarning): ...
# New classclassPytestPendingDeprecationWarning(PytestWarning, PendingDeprecationWarning): ...
The PytestDeprecationWarning should be used when adding deprecations right before a major release (when we had this case in pytest 6.0, we disabled them until after the release instead).
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
Activity
nicoddemus commentedon Jul 11, 2020
Also,
test_deprecation_warning_as_errorwill probably be removed.nicoddemus commentedon Jul 11, 2020
I'll be reverting these entries from the CHANGELOG:
EDIT: done in #7482
nicoddemus commentedon Aug 21, 2020
@RonnyPfannschmidt I just realized something.
The plan here is to have a function somewhat like this:
Usage:
However, because our version depends on the tag of the release, the actual pytest version will stay
6.Xuntil the actual tag7.0.0is pushed at release time, and in that moment that function will issuePytestExpiredDeprecationWarning, which will then break the actual release. Any ideas?RonnyPfannschmidt commentedon Aug 21, 2020
For implementation towncrier support in setuptools_scm is intended and planned
nicoddemus commentedon Aug 21, 2020
Not sure what you mean, can you elaborate please?
graingert commentedon Aug 21, 2020
Remember the stacklevel for warnings.warn:
RonnyPfannschmidt commentedon Aug 21, 2020
I strongly oppose combining declaration and triggering of warnings
RonnyPfannschmidt commentedon Aug 21, 2020
@nicoddemus if the next guessed version is based on semver + towncrier inference, it's 7.0.dev... As soon as a breaking change is merged
nicoddemus commentedon Aug 21, 2020
Noted, just to get this out of the way then:
Ahh I see, thanks.
Should we hold this issue until that happens then?
RonnyPfannschmidt commentedon Aug 21, 2020
Yup
nicoddemus commentedon Aug 21, 2020
Ahh I found it: pypa/setuptools-scm#332
OK then, let's hold then.
bluetech commentedon Aug 22, 2020
Is this a major headache? Making things conditional on our own
__version__might cause some headaches of its own...BTW, Django does something I like, which is embed the removal version in the warning type. This brings clarity to all involved, but might be getting too fancy.
Adapted to pytest (as of version 6.1), this would be:
When pytest 7 is released, changes to
When pytest 7.1 is released, changes to
The
PytestDeprecationWarningshould be used when adding deprecations right before a major release (when we had this case in pytest 6.0, we disabled them until after the release instead).RonnyPfannschmidt commentedon 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
Categorize deprecation warnings to `PytestRemovedInXWarning`
Merge #118
Merge #33 #34
Merge #33 #34
Merge #29
Merge #33
Merge #128
Merge #35 #36
Merge #31
chore(deps): update dependency pytest to v7 (#3)