[py-dev] Inspecting requested funcargs
holger at merlinux.eu
Mon Sep 24 17:11:11 CEST 2012
On Sun, Sep 23, 2012 at 17:45 +0100, Floris Bruynooghe wrote:
> Hi Holger,
> The new api tried to make it possible to know in advance which
> funcargs are required for a test function which is a very nice thing
> to have. However I'm not sure how to get to the full list:
> def arg0():
> def arg1(arg0):
> def setup(request):
> print request.node.funcargnames
> def test_foo(arg1):
> When executing this with py.test -s this only prints ['arg1'] and I
> have no idea how to find out that arg0 has also been
> created/requested. Is there a way to know all the requested funcargs?
This is solved now if you access "request.funcargnames" which
contains (along with metafunc.funcargnames) the full closure of
all used funcargs for the test function in question.
If one wants to just see the test function's funcargnames
there is request.node.funcargnames.
More information about the Pytest-dev