Fix getting the parser from the lazy step function on latest pytest

This commit is contained in:
Milosz Sliwinski 2018-10-08 09:52:47 +02:00 committed by Alessio Bogon
parent 6ce9c0c510
commit 92a7e59675
1 changed files with 7 additions and 2 deletions

View File

@ -58,10 +58,15 @@ def find_argumented_step_fixture_name(name, type_, fixturemanager, request=None)
# happens to be that _arg2fixturedefs is changed during the iteration so we use a copy
for fixturename, fixturedefs in list(fixturemanager._arg2fixturedefs.items()):
for fixturedef in fixturedefs:
parser = getattr(fixturedef.func, "parser", None)
if fixturedef.func.__name__ == 'lazy_step_func':
func = fixturedef.func()
else:
func = fixturedef.func
parser = getattr(func, "parser", None)
match = parser.is_matching(name) if parser else None
if match:
converters = getattr(fixturedef.func, "converters", {})
converters = getattr(func, "converters", {})
for arg, value in parser.parse_arguments(name).items():
if arg in converters:
value = converters[arg](value)