--- id: pytest-lazy-fixtures version: "1.4.1" license: MIT license_treatment: permissive maintenance: active --- # pytest-lazy-fixtures — Allows you to use fixtures in @pytest.mark.parametrize. License: permissive · Maintenance: active · Downloads: 2.2M/mo ## 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 above — 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 pip install pytest-lazy-fixtures uv add pytest-lazy-fixtures poetry add pytest-lazy-fixtures ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 2.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest parametrize with fixtures, lazy fixture pytest, fixture in parametrize decorator, pytest fixture reference, parametrize fixture injection, pytest-plugin, test-parametrization [View on SkillFed](https://skillfed.io/packages/pytest-lazy-fixtures) · [View on PyPI](https://pypi.org/project/pytest-lazy-fixtures/)