Skip to content

Commit 92a7e59

Browse files
sliwinski-miloszyoutux
authored andcommitted
Fix getting the parser from the lazy step function on latest pytest
1 parent 6ce9c0c commit 92a7e59

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pytest_bdd/scenario.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,15 @@ def find_argumented_step_fixture_name(name, type_, fixturemanager, request=None)
5858
# happens to be that _arg2fixturedefs is changed during the iteration so we use a copy
5959
for fixturename, fixturedefs in list(fixturemanager._arg2fixturedefs.items()):
6060
for fixturedef in fixturedefs:
61-
parser = getattr(fixturedef.func, "parser", None)
61+
if fixturedef.func.__name__ == 'lazy_step_func':
62+
func = fixturedef.func()
63+
else:
64+
func = fixturedef.func
65+
66+
parser = getattr(func, "parser", None)
6267
match = parser.is_matching(name) if parser else None
6368
if match:
64-
converters = getattr(fixturedef.func, "converters", {})
69+
converters = getattr(func, "converters", {})
6570
for arg, value in parser.parse_arguments(name).items():
6671
if arg in converters:
6772
value = converters[arg](value)

0 commit comments

Comments
 (0)