[py-dev] Generic funcarg hook
Floris Bruynooghe
flub at devork.be
Wed Aug 11 19:58:22 CEST 2010
Hello Holger
On Tue, Aug 10, 2010 at 11:01:09AM +0200, holger krekel wrote:
> to be sure i understand your use-case: could you invent
> an API/example that you'd like to see working?
def pytest_funcarg_factory(request):
if request.funcargname == 'foo':
return object()
elif request.funcargname == 'bar':
return object()
else:
raise KeyError()
And when it raises a KeyError (or does not exist) it would fall back
to the normal pytest_funcarg__name functions. So using a factory like
this would still be the exception rather then the rule, most funcargs
would come from pytest_funcarg__name functions.
Regards
Floris
--
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org
More information about the Pytest-dev
mailing list