← All notes

@pytest.mark.parametrize runs a test with several argument sets

Answer: pytest can parametrize tests at several levels. @pytest.mark.parametrize defines multiple sets of arguments (and fixtures) on a test function or class. pytest.fixture can also be parametrized. pytest_generate_tests is the hook for a custom scheme. The builtin decorator parametrizes the arguments of a test function: each tuple in the list becomes one test case.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: pytest docs, How to parametrize fixtures and test functions, MIT (https://raw.githubusercontent.com/pytest-dev/pytest/main/LICENSE); pytest-dev/pytest (GitHub), pytest mark structures (source), MIT (https://raw.githubusercontent.com/pytest-dev/pytest/main/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: pytest docs, How to parametrize fixtures and test functions, MIT (https://raw.githubusercontent.com/pytest-dev/pytest/main/LICENSE); pytest-dev/pytest (GitHub), pytest mark structures (source), MIT (https://raw.githubusercontent.com/pytest-dev/pytest/main/LICENSE).

Cite this

Permanent ID: iil:note:5e9ydx5z

iinventedlight. 2026. "@pytest.mark.parametrize runs a test with several argument sets." iinventedlight Library, iil:note:5e9ydx5z, version of 2026-11-16. https://iinventedlight.com/library/notes/pytest-parametrize/. License: CC-BY-4.0.

@misc{iil_note_5e9ydx5z,
  author = {{iinventedlight}},
  title = {{@pytest.mark.parametrize runs a test with several argument sets}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/pytest-parametrize/},
  note = {Permanent ID iil:note:5e9ydx5z. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/pytest-parametrize.md.