Skip to content

Commit f9583eb

Browse files
committed
Make logic more explicit and avoid type: ignore
1 parent 41a4618 commit f9583eb

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎src/pytest_bdd/compat.py‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ def inject_fixture(request: FixtureRequest, arg: str, value: object) -> None:
2525
:param arg: argument name
2626
:param value: argument value
2727
"""
28-
# Ensure there's a fixture definition for the argument.
29-
# pytest 9.1 deprecated the ``nodeid`` argument in favour of ``node``.
30-
scoping: dict[str, object]
3128
if pytest_version.release >= (9, 1):
32-
scoping = {"node": request.node}
29+
request._fixturemanager._register_fixture(
30+
name=arg,
31+
func=lambda: value,
32+
node=request.node,
33+
)
3334
else:
34-
scoping = {"nodeid": request.node.nodeid}
35-
request._fixturemanager._register_fixture(
36-
name=arg,
37-
func=lambda: value,
38-
**scoping, # type: ignore[arg-type]
39-
)
35+
request._fixturemanager._register_fixture(
36+
name=arg,
37+
func=lambda: value,
38+
nodeid=request.node.nodeid,
39+
)
4040
# Note the fixture we just registered will have a lower priority
4141
# if there was already one registered, so we need to force its value
4242
# to the one we want to inject.

0 commit comments

Comments
 (0)