pytest-lazy-fixture
It helps to use fixtures in pytest.mark.parametrize
What it is and what it does
pytest-lazy-fixture extends pytest's parametrize decorator to accept fixture references, bridging a gap between pytest's fixture system and its parametrization system. Normally, @pytest.mark.parametrize only accepts literal values; this package lets you pass pytest.lazy_fixture('fixture_name') to inject fixture values into parametrized tests at runtime. It also works in fixture parameter lists, allowing one fixture to depend on another fixture's parametrized values.
The package is a thin wrapper around pytest's internals and has no dependencies beyond pytest itself. It is dormant—last updated in early 2020—so it may not work reliably with recent pytest versions without maintenance.
Use it for:
- Parametrize a test with values from a fixture that itself has multiple parameter variants.
- Avoid duplicating test logic by reusing fixture definitions across multiple parametrized test cases.
- Chain fixtures together where one fixture's parameters depend on another fixture's output.
- Test the same function against multiple fixture-generated inputs without writing separate test functions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Allows you to use pytest fixtures directly as parameters in @pytest.mark.parametrize decorators and in other fixture parameter lists.
Yes, if your pytest version is stable and pre-2023. The package solves a real pytest limitation with low friction and no security issues. However, dormant maintenance means it may break with newer pytest releases—verify compatibility with your pytest version before adopting, and consider whether pytest's native parametrization patterns can meet your needs first.
Install
pytest-lazy-fixture on PyPI
pip
pip install pytest-lazy-fixtureuv
uv add pytest-lazy-fixturepoetry
poetry add pytest-lazy-fixtureInstalling pytest-lazy-fixture
Before you install
Low install friction with a single pytest dependency. Maintenance is dormant—last release was 2020-02-01 and no commits since 2023-10-02—so expect no active bug fixes or compatibility updates for newer pytest versions.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it safe for commercial and open-source projects.
Quickstart
pip install pytest-lazy-fixture
import pytest
@pytest.fixture(params=[1, 2])
def one(request):
return request.param
@pytest.mark.parametrize('arg1,arg2', [
('val1', pytest.lazy_fixture('one')),
])
def test_func(arg1, arg2):
assert arg2 in [1, 2]
Verify before relying
- Compatibility with pytest versions released after 2023-10-02 is unclear given dormant maintenance status.
- Whether this package is superseded by built-in pytest functionality or a maintained alternative.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pytest |
| Maintenance | dormant — 2,386 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 608,183/month — #5,781 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_lazy_fixture-0.6.3-py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
pytest-fixture-configProvides configuration objects and decorators…
permissive · top 15,000 on PyPI
pytest-lazy-fixturesAllows you to reference pytest fixtures…
permissive · top 5,000 on PyPI
pytest-parametrizationProvides decorator-based parametrization for…
permissive · top 15,000 on PyPI
pytest-raisesProvides pytest markers (@pytest.mark.raises…
unclear · top 15,000 on PyPI
pytest-casespytest-cases lets you separate test case data…
permissive · top 5,000 on PyPI
pytest-printAdds fixtures to pytest that print messages…
permissive · top 15,000 on PyPI
parametrizeProvides a `@parametrize` decorator that works…
permissive · top 15,000 on PyPI
pytest-factoryboyIntegrates factory_boy with pytest to register…
permissive · top 5,000 on PyPI
pytest-unused-fixturesA pytest plugin that identifies and reports…
permissive · top 15,000 on PyPI