Skip to content
Discussion options

You must be logged in to vote

@aiwonderlandpytest.yield_fixture was deprecated in pytest 3.0 (August 2016). The current pytest source still ships it as a thin wrapper that just calls @pytest.fixture and emits a deprecation warning:

@pytest.yield_fixture is deprecated. Use @pytest.fixture instead;
they are the same.

It still works — but you should migrate.

Why it was deprecated: before pytest 3.0, @pytest.fixture only supported return-style fixtures; setup/teardown via yield required the separate @pytest.yield_fixture decorator. In 3.0 the regular @pytest.fixture was extended to handle yield as well, making the two decorators do exactly the same thing — so the dedicated yield_fixture became redundant.

What to use:

i…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by aiwonderland
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants