Exemple #1
0
 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 = fixtures.getfuncargnames(func)
     fixtureinfo = FixtureInfo(names)
     return python.Metafunc(func, fixtureinfo, None)
    def _decorator(func):
        arg_names = fixtures.getfuncargnames(func)

        def _inner(request):
            requested_fixtures = [
                request.getfixturevalue(n) for n in arg_names
            ]
            module_transaction = request.getfixturevalue('module_transaction')
            with module_transaction(request.fixturename):
                yield func(*requested_fixtures)

        return pytest.fixture(scope=scope, name=func.__name__)(_inner)