fix empty parameterset tests by mocking a config object

This commit is contained in:
Ronny Pfannschmidt 2017-12-17 15:25:56 +01:00
parent 37b41de779
commit 7f83605c81
1 changed files with 15 additions and 3 deletions

View File

@ -14,7 +14,7 @@ PY3 = sys.version_info >= (3, 0)
class TestMetafunc(object):
def Metafunc(self, func):
def Metafunc(self, func, config=None):
# the unit tests of this class check if things work correctly
# on the funcarg level, so we don't need a full blown
# initiliazation
@ -26,7 +26,7 @@ class TestMetafunc(object):
names = fixtures.getfuncargnames(func)
fixtureinfo = FixtureInfo(names)
return python.Metafunc(func, fixtureinfo, None)
return python.Metafunc(func, fixtureinfo, config)
def test_no_funcargs(self, testdir):
def function():
@ -156,7 +156,19 @@ class TestMetafunc(object):
def test_parametrize_empty_list(self):
def func(y):
pass
metafunc = self.Metafunc(func)
class MockConfig(object):
def getini(self, name):
return ''
@property
def hook(self):
return self
def pytest_make_parametrize_id(self, **kw):
pass
metafunc = self.Metafunc(func, MockConfig())
metafunc.parametrize("y", [])
assert 'skip' == metafunc._calls[0].marks[0].name