Install & Compatibility
Where this runs
tested against v2022.2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 32.2MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.6s · import 0.000s · 33MB
30MB installed
● package 30MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Parametrization
✓ from parametrization import Parametrization
✗ from parametrization import parametrize
This example demonstrates how to use the `@parametrize` decorator from the `pytest-parametrization` plugin. It allows defining parameters using keyword arguments, where the values for each parameter are lists. The plugin also supports custom test IDs.
from parametrization import parametrize
import pytest
@parametrize(
a=[1, 2],
b=[2, 4]
)
def test_addition(a, b):
assert a + b == a + b
@parametrize(
num=[(1, 'one'), (2, 'two')],
ids=['test_one', 'test_two']
)
def test_number_to_word(num, ids):
number, word = num
if number == 1:
assert word == 'one'
elif number == 2:
assert word == 'two'
# To run: pytest -v your_test_file.py
Debug
Known issues
gotchaThis library provides an alternative syntax (`from parametrization import parametrize`) to the standard Pytest parametrization (`@pytest.mark.parametrize`). Users should be aware they are using a plugin with its own conventions, not the built-in decorator directly.fixEnsure you explicitly import `parametrize` from `parametrization` and understand its distinct usage pattern.
affects: All versions
gotchaWhen passing mutable objects (like lists or dictionaries) as parameters, `pytest` (and by extension this plugin) passes them by reference, not by copy. Modifying a mutable parameter in one test case will affect subsequent test cases that receive the same parameter instance.fixIf mutable parameters need to be unique per test, make a deep copy within the test function or use fixtures for setup that return new instances.
affects: All versions
gotchaThere's a known `pytest` core issue with `@pytest.mark.parametrize` causing reference leaks on newer Python versions (3.12+), preventing reliable object cleanup by the GC during interpreter shutdown. While this is a `pytest` core problem, it impacts any test using parametrization, including those with `pytest-parametrization`.fixKeep `pytest` and Python updated. If encountering significant issues with leak reporting in specific scenarios (e.g., C++ bindings), monitor `pytest`'s issue tracker for updates on Issue #11773.
affects: Python 3.12+ (Pytest 8.0+)
Upgrade
Version history
2022.2.1latest on PyPI · released May 22, 2022
Audit
Dependencies
pytestrequiredThis is a pytest plugin and requires pytest to function.
pythonrequiredRequires Python versions >=2.6 and not 3.0-3.3.