def Metafunc(self, func): # the unit tests of this class check if things work correctly # on the funcarg level, so we don't need a full blown # initiliazation class FixtureInfo: name2fixturedefs = None def __init__(self, names): self.names_closure = names names = funcargs.getfuncargnames(func) fixtureinfo = FixtureInfo(names) return funcargs.Metafunc(func, fixtureinfo, None)
def test_wrapped_getfuncargnames(self): from _pytest.python import getfuncargnames def wrap(f): def func(): pass func.__wrapped__ = f return func @wrap def f(x): pass l = getfuncargnames(f) assert l == ("x",)
def test_wrapped_getfuncargnames_patching(self): from _pytest.python import getfuncargnames def wrap(f): def func(): pass func.__wrapped__ = f func.patchings = ["qwe"] return func @wrap def f(x, y, z): pass l = getfuncargnames(f) assert l == ("y", "z")
def test_wrapped_getfuncargnames(self): from _pytest.python import getfuncargnames def wrap(f): def func(): pass func.__wrapped__ = f return func @wrap def f(x): pass l = getfuncargnames(f) assert l == ("x", )