fix: avoid deprecated nodeid argument to _register_fixture - #827
Open
Sanjays2402 wants to merge 1 commit into
Open
fix: avoid deprecated nodeid argument to _register_fixture#827Sanjays2402 wants to merge 1 commit into
Sanjays2402 wants to merge 1 commit into
Conversation
Injecting a step's target_fixture called FixtureManager._register_fixture(nodeid=...). pytest 9.1 deprecated the nodeid argument in favour of node, so every scenario using a target_fixture emitted PytestRemovedIn10Warning, and suites that turn deprecation warnings into errors failed at collection. Pass node=request.node on pytest >= 9.1 and keep nodeid on older versions, matching the existing version-branching in compat.py. Added a regression test asserting the injection scenario runs clean under -W error::DeprecationWarning; it fails without this change.
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.
Closes #823
inject_fixturecallsFixtureManager._register_fixture(nodeid=...), which pytest 9.1 deprecated in favour ofnode=, so every scenario using atarget_fixtureemitsPytestRemovedIn10Warning(and fails outright in suites that error on deprecation warnings). Now passesnode=request.nodeon pytest >= 9.1 and keepsnodeidon older versions, matching the existing version-branching incompat.py.Regression test added in
tests/steps/test_given.py; it fails on master and passes with the fix. Full suite is unchanged on pytest 9.1, andtests/steps+tests/featurestill pass on pytest 9.0.