remove distinction of new versus old funcarg factories

This commit is contained in:
holger krekel 2012-09-18 10:53:42 +02:00
parent 631d311e89
commit d9c24552fc
1 changed files with 2 additions and 7 deletions

View File

@ -1363,12 +1363,10 @@ class FuncargManager:
argname = name argname = name
scope = marker.scope scope = marker.scope
params = marker.params params = marker.params
new = True
elif name.startswith(self._argprefix): elif name.startswith(self._argprefix):
argname = name[len(self._argprefix):] argname = name[len(self._argprefix):]
scope = None scope = None
params = None params = None
new = False
else: else:
# no funcargs. check if we have a setup function. # no funcargs. check if we have a setup function.
setup = getattr(obj, "_pytestsetup", None) setup = getattr(obj, "_pytestsetup", None)
@ -1378,8 +1376,7 @@ class FuncargManager:
self.setuplist.append(sf) self.setuplist.append(sf)
continue continue
faclist = self.arg2facspec.setdefault(argname, []) faclist = self.arg2facspec.setdefault(argname, [])
factorydef = FactoryDef(self, nodeid, argname, obj, scope, params, factorydef = FactoryDef(self, nodeid, argname, obj, scope, params)
new)
faclist.append(factorydef) faclist.append(factorydef)
### check scope/params mismatch? ### check scope/params mismatch?
@ -1489,15 +1486,13 @@ class SetupCall:
class FactoryDef: class FactoryDef:
""" A container for a factory definition. """ """ A container for a factory definition. """
def __init__(self, funcargmanager, baseid, argname, func, scope, params, def __init__(self, funcargmanager, baseid, argname, func, scope, params):
new):
self.funcargmanager = funcargmanager self.funcargmanager = funcargmanager
self.baseid = baseid self.baseid = baseid
self.func = func self.func = func
self.argname = argname self.argname = argname
self.scope = scope self.scope = scope
self.params = params self.params = params
self.new = new
self.funcargnames = getfuncargnames(func) self.funcargnames = getfuncargnames(func)
def getfuncargnames(function, startindex=None): def getfuncargnames(function, startindex=None):