diff --git a/changelog/13155.doc.rst b/changelog/13155.doc.rst new file mode 100644 index 00000000000..a4faf22fa4a --- /dev/null +++ b/changelog/13155.doc.rst @@ -0,0 +1 @@ +Clarified how the ``request`` fixture provides indirect parametrization values via ``request.param``. diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index ae64a7c62d5..de668def863 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -370,9 +370,19 @@ test: def test_indirect(fixt): assert len(fixt) == 3 + This can be used, for example, to do more expensive setup at test run time in the fixture, rather than having to run those setup steps at collection time. +.. note:: + + The ``request`` argument used by the fixture is pytest's built-in + :py:class:`FixtureRequest ` fixture. For indirect + parametrization, the value supplied to the test parameter is passed to the + fixture and made available as ``request.param``. + + For more information, see :ref:`fixture-parametrize`. + .. regendoc:wipe Apply indirect on particular arguments