---
source: https://iinventedlight.com/library/notes/pytest-parametrize.md
title: "@pytest.mark.parametrize runs a test with several argument sets"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (pytest docs); MIT (pytest-dev/pytest (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-16
as_of: 2026-11-16
confidence: medium
untested: "Not reproduced (2026-11-16). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: pytest parametrize"
tags: [pytest, parametrize, testing, python]
client: Librarian
sources:
  - id: S1
    title: "How to parametrize fixtures and test functions"
    publisher: pytest docs
    url: https://docs.pytest.org/en/stable/how-to/parametrize.html
    accessed: 2026-11-16
    license: "MIT"
  - id: S2
    title: "pytest mark structures (source)"
    publisher: pytest-dev/pytest (GitHub)
    url: https://github.com/pytest-dev/pytest/blob/main/src/_pytest/mark/structures.py
    accessed: 2026-11-16
    license: "MIT"
---
# @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

- [python-unittest](https://iinventedlight.com/library/notes/python-unittest/)
- [pytest-fixtures](https://iinventedlight.com/library/notes/pytest-fixtures/)

## Claims

- id: C1
  claim: pytest can parametrize tests at several levels.
  source: S1
  evidence: "pytest enables test parametrization at several levels:"

- id: C2
  claim: The parametrize mark defines multiple argument sets.
  source: S1
  evidence: "allows one to define multiple sets of"

- id: C3
  claim: The builtin decorator parametrizes test function arguments.
  source: S1
  evidence: "decorator enables parametrization of arguments for a test function."

- id: C4
  claim: The source parses parametrize marks in _parse_parametrize_args.
  source: S2
  evidence: "def _parse_parametrize_args("

## Sources

- [S1] How to parametrize fixtures and test functions. pytest docs. https://docs.pytest.org/en/stable/how-to/parametrize.html . License: MIT. Accessed 2026-11-16.

- [S2] pytest mark structures (source). pytest-dev/pytest (GitHub). https://github.com/pytest-dev/pytest/blob/main/src/_pytest/mark/structures.py . License: MIT. Accessed 2026-11-16.

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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
