Repository navigation
Slate yield_fixture decorator for removal in pytest 10 - #14755
Conversation
aebb7fb to
f7c3caf
Compare
3558bad to
cd388a7
Compare
cd388a7 to
8b32b8e
Compare
nicoddemus
left a comment
There was a problem hiding this comment.
Let's also mention in
pytest/doc/en/deprecations.rst
Lines 420 to 427 in f52ff0c
|
For what it's worth, while I was +1 for removing it, our Backwards Compatibility Policy states:
So I suppose this is technically going against that documented policy. |
8b32b8e to
47bf797
Compare
Interesting, thanks for pointing that out. I wasn't aware of this. I do recognize that indefinitely is a very long time, though :) |
|
@pytest-dev/core id like to propose replacing indefinitely in that policy with something more time constrained This one had more than a decade I like something like a 5 year extended deadline |
|
We might create a conveniant upgrade script to make the translation bearable without following the minute details in the changelog for users. (And thus make the period even shorter) |
|
Is there a ruff rule? |
|
Indeed but without autofix; https://docs.astral.sh/ruff/rules/pytest-deprecated-yield-fixture/ For this case in particular contributing the autofix to ruff is the way to go imo. But in general if we want to reduce the deprecation period in pytest shouldn't we have our own script ? |
`pytest.yield_fixture` is a plain alias for `pytest.fixture`, so the rule can offer the rewrite rather than only reporting it. Following discussion in pytest-dev/pytest#14755. where we consider deleting the function in pytest 10. It's better if an autofix exists. I marked it as safe becuase 'fixture' is equivalent afaiu.
|
why make a own script if we can document a |
|
Not all deprecations will have their own ruff rule that we can merge easily because it was already implemented in another tool (in particular new deprecation we'll introduce in the future won't). Not sure if making a ruff rule immediately when we deprecate something is going to be an easy sell to the ruff team. |
|
Not all thing's need a ruff rule So it anhillates a large part of the churn |
|
based on the ruff pr and the current sentiment i'd like to get a last confirmation before merging this |
… in `PT020` pytest-dev/pytest#14755 slated the decorator for removal in pytest 10; it now raises `PytestRemovedIn10Warning` instead of a bare deprecation warning.
Spell out why the alias exists and what happens to it: `pytest.fixture` has supported `yield` since pytest 3.0, the alias has been deprecated since 6.2, and pytest-dev/pytest#14755 slated it for removal in pytest 10, so it now raises `PytestRemovedIn10Warning`.
## Summary Following discussion in pytest-dev/pytest#14755. where we consider deleting the function in pytest 10. It's better if an autofix exists. I marked it as safe becuase ``fixture`` is equivalent afaiu. (Probably better to wait for a decision in the other issue to document it in this PR if it's removed in pytest 10) ## Test Plan Took example with NPY003's implementation, tested alias for yield_fixture and pytest, and various imports, used bare, with parens, with args, with trailing comment, and inside a class.
Schedules the deprecated yield_fixture decorator for removal in pytest 10.