Skip to content

Doc: improve discoverability of passing parameters to fixture functions - #15038

Open
maram-odoo wants to merge 2 commits into
pytest-dev:mainfrom
maram-odoo:issue-8109-fixture-params-discoverability
Open

maram-odoo wants to merge 2 commits into
pytest-dev:mainfrom
maram-odoo:issue-8109-fixture-params-discoverability

Conversation

@maram-odoo

Copy link
Copy Markdown

Summary

  • Adds a dedicated "Passing arguments to fixture functions" section to the fixtures HOWTO doc that clearly explains the request.param + indirect=True pattern with a worked example
  • Updates the @pytest.fixture() docstring to mention indirect parametrization and cross-reference the relevant documentation
  • Adds a :ref:indirect parametrization`` label anchor in doc/en/example/parametrize.rst so the cross-reference resolves correctly

Fixes #8109

Test plan

  • make html should render without warnings — verify the new cross-references resolve
  • python -c "from _pytest.fixtures import fixture; help(fixture)" shows the updated params: docstring
  • Quick smoke test: run the example from the new HOWTO section as a standalone test file

🤖 Generated with Claude Code

open-source-contributer and others added 2 commits September 16, 2026 15:03
The existing mechanism for passing parameters to fixtures via
`request.param` and indirect parametrization is functional but hard
to discover. This improves discoverability in three ways:

1. Adds a dedicated "Passing arguments to fixture functions" section to
   the fixtures HOWTO doc (doc/en/how-to/fixtures.rst) that clearly
   explains the pattern with a worked example.

2. Updates the `@pytest.fixture()` docstring (src/_pytest/fixtures.py)
   to mention indirect parametrization and point users to the relevant
   documentation section.

3. Adds a reference label anchor in doc/en/example/parametrize.rst so
   the :ref:`indirect parametrization` cross-reference resolves correctly
   from both the fixture docstring and the new HOWTO section.

Fixes pytest-dev#8109

Co-authored-by: open-source-contributer <open-source-contributer@hermes.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a more obvious way to pass parameters to fixture functions

1 participant