pytest-lazy-fixtures
Allows you to use fixtures in @pytest.mark.parametrize.
What it is and what it does
pytest-lazy-fixtures extends pytest's parametrize decorator to accept fixture references as parameter values, solving the limitation that fixtures cannot normally be used directly in @pytest.mark.parametrize. It provides two main tools: lf (lazy_fixture) for simple fixture references and lfc (lazy_fixture_callable) for wrapping callables that should receive fixture values. The package supports fixtures nested in data structures (lists, dicts, tuples), attribute access via dot notation (e.g., lf('fixture.attr')), and automatic parameter injection based on callable signatures.
The package depends only on pytest and is compatible with other pytest plugins. It targets Python 3.8 and above and is distributed under the MIT license, making it suitable for most projects.
Use it for:
- Parametrize tests with fixture-derived values without duplicating fixture logic in test parameters.
- Test multiple scenarios where each scenario needs a fresh instance of a complex fixture object.
- Build parametrized test cases that reference fixture attributes or call fixture methods.
- Use fixtures as arguments to custom callables within parametrize, enabling flexible test data composition.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Allows you to reference pytest fixtures directly within @pytest.mark.parametrize decorators, including nested data structures and fixture attributes.
Yes. The package solves a genuine pytest limitation with low install friction, active maintenance, no known vulnerabilities, and a permissive MIT license. It is well-suited for projects that need to parametrize tests with fixture-derived values.
Install
pytest-lazy-fixtures on PyPI
pip
pip install pytest-lazy-fixturesuv
uv add pytest-lazy-fixturespoetry
poetry add pytest-lazy-fixturesInstalling pytest-lazy-fixtures
Before you install
Low friction install with a single runtime dependency on pytest. Actively maintained with last commit 2026-08-12 and 113 repository stars.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install pytest-lazy-fixtures
import pytest
from pytest_lazy_fixtures import lf
@pytest.fixture()
def one():
return 1
@pytest.mark.parametrize('arg1,arg2', [('val1', lf('one'))])
def test_func(arg1, arg2):
assert arg2 == 1
Requires pytest as a runtime dependency.
Verify before relying
- Whether implicit fixture injection from callable signatures works reliably across all pytest versions.
- Performance impact when parametrizing tests with large numbers of lazy fixture references.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pytest |
| Maintenance | actively maintained — 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,186,025/month — #3,225 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_lazy_fixtures-1.4.1-py3-none-any.whl
Keywords: fixture, lazy, pytest, tests
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-lazy-fixtureAllows you to use pytest fixtures directly as…
permissive · top 15,000 on PyPI
pytest-printAdds fixtures to pytest that print messages…
permissive · top 15,000 on PyPI
pytest-casespytest-cases lets you separate test case data…
permissive · top 5,000 on PyPI
fixturesProvides a reusable fixture contract for unit…
permissive · top 15,000 on PyPI
pytest-fixture-configProvides configuration objects and decorators…
permissive · top 15,000 on PyPI
pytest-deadfixturesA pytest plugin that identifies unused and…
permissive · top 5,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
parametrizeProvides a `@parametrize` decorator that works…
permissive · top 15,000 on PyPI
pytest-describeA pytest plugin that organizes tests into…
permissive · top 5,000 on PyPI