Repository navigation
Use pytest.fixture instead of the deprecated pytest.yield_fixture - #56
Merged
nicoddemus merged 4 commits intoNov 18, 2026
Merged
Conversation
pytest 9 emits PytestRemovedIn10Warning for @pytest.yield_fixture when pytest_services.folders is imported, which breaks runs with -W error. pytest.fixture has supported yield since pytest 3. Fixes pytest-dev#55
nicoddemus
reviewed
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #55
Problem
With pytest 9, importing
pytest_services.foldersemitsPytestRemovedIn10Warning: @pytest.yield_fixture is deprecatedfor both session fixtures in that module. Any project that runs with-W errorfails as soon as the plugin loads.Fix
Both decorators now use
@pytest.fixture. It has supportedyieldfixtures since pytest 3, and setup.py doesn't pin an older pytest. I also added a changelog entry under UNRELEASED.Testing
New test
test_folders_import_does_not_warnreloadspytest_services.folderswith warnings turned into errors. It fails onmainand passes with this change.Commands run, on Python 3.12 with pytest 9.2.0:
pytest tests -k "not memcached and not mysql": 5 passed.pylibmcormysqlclientwithout a C compiler.PytestRemovedIn10Warningentries are gone from the warnings summary.This change is