[py-dev] Inspecting requested funcargs

holger krekel holger at merlinux.eu
Mon Sep 24 17:11:11 CEST 2012

Hi Floris,

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:
> @pytest.factory()
> def arg0():
>     pass
> @pytest.factory()
> def arg1(arg0):
>     pass
> @pytest.setup()
> def setup(request):
>     print request.node.funcargnames
> def test_foo(arg1):
>     pass
> 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 mailing list