Skip to content

Commit b62f5e2

Browse files
authored
Merge pull request #34 from YannickJadoul/master
Fix for pytest versions >= 3.6.0, < 3.7.0, fixes #33
2 parents 56ae265 + 2fc26bb commit b62f5e2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pytest_lazyfixture.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,11 @@ def normalize_call(callspec, metafunc, valtype, used_keys):
9999
if is_lazy_fixture(val):
100100
try:
101101
_, fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure([val.name], metafunc.definition.parent)
102+
except ValueError:
103+
# 3.6.0 <= pytest < 3.7.0; `FixtureManager.getfixtureclosure` returns 2 values
104+
fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure([val.name], metafunc.definition.parent)
102105
except AttributeError:
103-
# pytest < 3.10.0
106+
# pytest < 3.6.0; `Metafunc` has no `definition` attribute
104107
fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure([val.name], current_node)
105108

106109
extra_fixturenames = [fname for fname in fixturenames_closure

0 commit comments

Comments
 (0)