pytest-lazy-fixture is a plugin for the pytest testing framework that allows users to pass fixtures as values directly within `pytest.mark.parametrize` decorators. This simplifies test parameterization by enabling the reuse of fixtures where direct fixture injection is not typically supported. The current version is 0.6.3, but the library is no longer actively maintained and has known compatibility issues with newer pytest versions.
pip install pytest-lazy-fixtureVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `lazy_fixture` to pass the return value of `my_fixture` as a parameter to `test_example` using `pytest.mark.parametrize`.
Downgrade pytest to a version below 8.0.0 (e.g., `pytest==7.3.2`) or consider migrating to an actively maintained alternative like `pytest-lazy-fixtures` (note the 's').
It is highly recommended to migrate to `pytest-lazy-fixtures` (note the 's'), which is a community-maintained fork offering similar functionality and active development. Alternatively, consider using `request.getfixturevalue` for basic cases or redesigning tests to avoid this pattern if possible.
Be aware of the execution timing. If you need fixture values to influence test collection or other pre-execution steps, `lazy_fixture` is not the appropriate tool.
Ensure your pytest version is 3.3.0 or higher when using pytest-lazy-fixture >= 0.4.0.
pip install pytest-lazy-fixture
from pytest_lazy_fixture import lazy_fixture
Downgrade pytest to a compatible version (e.g., pytest<7.0.0), or migrate to actively maintained alternatives like pytest-cases.
Ensure pytest is a version compatible with pytest-lazy-fixture (e.g., pytest<7.0.0). Verify that lazy_fixture is used correctly as an individual item within the parameter list.
Downgrade `pytest` to a version older than 7.0 (e.g., `pip install pytest<7.0`). Alternatively, rewrite tests to avoid `pytest-lazy-fixture` as it is unmaintained.