Closed mp2218 closed 6 months ago
I ran into this yesterday as well. Here's the relevant pytest change, it's there from version 8.1.1
I was able to reproduce this locally running the pytest-bdd
tests with the latest pytest version. I could also fix them by updating the call to FixtureDef
in inject_fixture
here: https://github.com/pytest-dev/pytest-bdd/blob/master/src/pytest_bdd/steps.py#L213
but obviously it then breaks compatibility with previous versions of pytest. The compat.py
file is already addressing what looks like a related compatibility issue, with two different functions depending on whether pytest is below or above 8.1, so creating a function there that instantiates FixtureDef
differently based on the version worked for me locally.
It's not the nicest solution, but I'm happy to open a PR with these changes if it'll help.
Fixed in https://github.com/pytest-dev/pytest-bdd/pull/680. I just released version 7.1.2 with the fix
Test which had fixture injection worked fine last week, but now with new pytest release breaks with following trace:
snippet of fixture injection:
@given("User does not have credit", target_fixture="fielding_page") def no_money(context_logged_in, base_url): return Fielding_Page(context_logged_in.new_page(), base_url)
Version: bdd-7.1.1 `