Skip to content

Commit 757b055

Browse files
committed
Make code more straight forward and avoid using pytest internals
1 parent 4859450 commit 757b055

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pytest_bdd/generation.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,16 @@ def _find_step_fixturedef(fixturemanager, item, name, type_):
116116
117117
:return: Step function.
118118
"""
119-
fixturedefs = fixturemanager.getfixturedefs(get_step_fixture_name(name, type_), item.nodeid)
120-
if not fixturedefs:
121-
name = find_argumented_step_fixture_name(name, type_, fixturemanager)
122-
if name:
123-
return fixturemanager._arg2fixturedefs.get(name, None)
124-
else:
119+
step_fixture_name = get_step_fixture_name(name, type_)
120+
fixturedefs = fixturemanager.getfixturedefs(step_fixture_name, item.nodeid)
121+
if fixturedefs is not None:
125122
return fixturedefs
126123

124+
argumented_step_name = find_argumented_step_fixture_name(name, type_, fixturemanager)
125+
if argumented_step_name is not None:
126+
return fixturemanager.getfixturedefs(argumented_step_name, item.nodeid)
127+
return None
128+
127129

128130
def parse_feature_files(paths, **kwargs):
129131
"""Parse feature files of given paths.

0 commit comments

Comments
 (0)