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..8b68662950f 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -370,6 +370,11 @@ test: def test_indirect(fixt): assert len(fixt) == 3 +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``. + 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.