Mark yield_fixture as deprecated#14340
Conversation
928816a to
646d5e2
Compare
646d5e2 to
61f7b83
Compare
bluetech
left a comment
There was a problem hiding this comment.
Thanks, however the hitch here is that @deprecated also emits a runtime warning, so with this we will be emitting 2 runtime deprecation warnings. You could say, let's remove the existing runtime deprecation, the problem with that is that our compat for Python < 3.13 doesn't emit a runtime warning. This has been fine so far since we only use @deprecated under TYPE_CHECKING, but here it's not.
So either
- We backport
@deprecatedruntime behavior. But the Python code is about a 100 lines, a bit too much I think. - We move the
@deprecatedunderTYPE_CHECKING(duplicatingdef yield_fixture), that's a bit ugly though. - We leave as is for now.
|
|
||
|
|
||
| @deprecated( | ||
| "pytest.yield_fixture is deprecated, use pytest.fixture to access configuration values instead.", |
There was a problem hiding this comment.
Let's use the same text as the existing runtime deprecation.
| "pytest.yield_fixture is deprecated, use pytest.fixture to access configuration values instead.", | |
| "@pytest.yield_fixture is deprecated. Use @pytest.fixture instead; they are the same.", |
|
thanks for your response!
sure, happy to do this! |
|
I'd go for (trivial) option 4: Pass I think there is a lot of value in having deprecations visible statically, so I opened #14342 to that effect. Thanks @MarcoGorelli for getting the ball rolling! |
yield_fixture
is deprecated, is it ok to use thedeprecated` decorator on it?pytest/src/_pytest/fixtures.py
Lines 1434 to 1435 in 959cd47