skillfed

pytest-lazy-fixture

It helps to use fixtures in pytest.mark.parametrize

pytest-lazy-fixture v0.6.3 608.2K downloads/30d#5,781 on PyPI396
Permissive license MIT DORMANT released

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-fixture

uv

uv add pytest-lazy-fixture

poetry

poetry add pytest-lazy-fixture

Installing 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

Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing

Tags

pytest fixtures in parametrizelazy fixture pytestparametrize with fixturespytest fixture parametersdynamic test parametrization
pytest-plugintest-parametrization

More Testing packages