Skip to main content

It helps to use fixtures in pytest.mark.parametrize

Project description

Use your fixtures in @pytest.mark.parametrize.


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]

Also you can use it as a parameter in @pytest.fixture:

import pytest

def some(request):
    return request.param

def one():
    return 1

def two():
    return 2

def test_func(some):
    assert some in [1, 2]

Please see tests for more examples.


Contributions are very welcome. Tests can be run with tox.


Distributed under the terms of the MIT license, pytest-lazy-fixture is free and open source software


If you encounter any problems, please file an issue along with a detailed description.

Project details

Release history Release notifications

This version
History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pytest-lazy-fixture-0.4.0.tar.gz (4.6 kB) Copy SHA256 hash SHA256 Source None Nov 30, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page