Skip to content

Commit 2b62717

Browse files
fix empty parameterset tests by mocking a config object
1 parent 156abd0 commit 2b62717

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

testing/python/metafunc.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
class TestMetafunc(object):
17-
def Metafunc(self, func):
17+
def Metafunc(self, func, config=None):
1818
# the unit tests of this class check if things work correctly
1919
# on the funcarg level, so we don't need a full blown
2020
# initiliazation
@@ -26,7 +26,7 @@ def __init__(self, names):
2626

2727
names = fixtures.getfuncargnames(func)
2828
fixtureinfo = FixtureInfo(names)
29-
return python.Metafunc(func, fixtureinfo, None)
29+
return python.Metafunc(func, fixtureinfo, config)
3030

3131
def test_no_funcargs(self, testdir):
3232
def function():
@@ -156,7 +156,19 @@ def func(x, y):
156156
def test_parametrize_empty_list(self):
157157
def func(y):
158158
pass
159-
metafunc = self.Metafunc(func)
159+
160+
class MockConfig(object):
161+
def getini(self, name):
162+
return ''
163+
164+
@property
165+
def hook(self):
166+
return self
167+
168+
def pytest_make_parametrize_id(self, **kw):
169+
pass
170+
171+
metafunc = self.Metafunc(func, MockConfig())
160172
metafunc.parametrize("y", [])
161173
assert 'skip' == metafunc._calls[0].marks[0].name
162174

0 commit comments

Comments
 (0)