Skip to content

fix: avoid deprecated nodeid argument to _register_fixture - #827

Open
Sanjays2402 wants to merge 1 commit into
pytest-dev:masterfrom
Sanjays2402:fix-register-fixture-node-deprecation
Open

fix: avoid deprecated nodeid argument to _register_fixture#827
Sanjays2402 wants to merge 1 commit into
pytest-dev:masterfrom
Sanjays2402:fix-register-fixture-node-deprecation

Conversation

@Sanjays2402

Copy link
Copy Markdown

Closes #823

inject_fixture calls FixtureManager._register_fixture(nodeid=...), which pytest 9.1 deprecated in favour of node=, so every scenario using a target_fixture emits PytestRemovedIn10Warning (and fails outright in suites that error on deprecation warnings). Now passes node=request.node on pytest >= 9.1 and keeps nodeid on older versions, matching the existing version-branching in compat.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, and tests/steps + tests/feature still pass on pytest 9.0.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecation warnings with pytest 9.1.1 and python 3.14.0

1 participant