internally rename "provider" to "factory" to be consistent

with documentation.

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-09-30 12:59:47 +02:00
parent 98b2300266
commit 5914277f92
2 changed files with 10 additions and 10 deletions

View File

@ -95,7 +95,7 @@ class FuncargRequest:
if self.instance is not None:
self._plugins.append(self.instance)
self._funcargs = self._pyfuncitem.funcargs.copy()
self._provider = {}
self._name2factory = {}
self._currentarg = None
def _fillfuncargs(self):
@ -138,19 +138,19 @@ class FuncargRequest:
return self._funcargs[argname]
except KeyError:
pass
if argname not in self._provider:
self._provider[argname] = self.config.pluginmanager.listattr(
if argname not in self._name2factory:
self._name2factory[argname] = self.config.pluginmanager.listattr(
plugins=self._plugins,
attrname=self._argprefix + str(argname)
)
#else: we are called recursively
if not self._provider[argname]:
if not self._name2factory[argname]:
self._raiselookupfailed(argname)
funcargprovider = self._provider[argname].pop()
funcargfactory = self._name2factory[argname].pop()
oldarg = self._currentarg
self._currentarg = argname
try:
self._funcargs[argname] = res = funcargprovider(request=self)
self._funcargs[argname] = res = funcargfactory(request=self)
finally:
self._currentarg = oldarg
return res

View File

@ -115,7 +115,7 @@ class TestRequest:
assert req.cls.__name__ == "TestB"
assert req.instance.__class__ == req.cls
def XXXtest_request_contains_funcargs_provider(self, testdir):
def XXXtest_request_contains_funcarg_name2factory(self, testdir):
modcol = testdir.getmodulecol("""
def pytest_funcarg__something(request):
pass
@ -125,9 +125,9 @@ class TestRequest:
""")
item1, = testdir.genitems([modcol])
assert item1.name == "test_method"
provider = funcargs.FuncargRequest(item1)._provider
assert len(provider) == 1
assert provider[0].__name__ == "pytest_funcarg__something"
name2factory = funcargs.FuncargRequest(item1)._name2factory
assert len(name2factory) == 1
assert name2factory[0].__name__ == "pytest_funcarg__something"
def test_getfuncargvalue_recursive(self, testdir):
testdir.makeconftest("""