It helps to use fixtures in pytest.mark.parametrize
Project description
Use your fixtures in @pytest.mark.parametrize.
Usage
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
@pytest.fixture(params=[
pytest.lazy_fixture('one'),
pytest.lazy_fixture('two')
])
def some(request):
return request.param
@pytest.fixture
def one():
return 1
@pytest.fixture
def two():
return 2
def test_func(some):
assert some in [1, 2]
Please see tests for more examples.
Contributing
Contributions are very welcome. Tests can be run with tox.
License
Distributed under the terms of the MIT license, pytest-lazy-fixture is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for pytest-lazy-fixture-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7c56df192f8d4d1ce7d8fed82717eb54833447abe73b851b4c105bea36eab69 |
|
MD5 | 748f7f60901f8e0125e4122944735a78 |
|
BLAKE2b-256 | 390370345c3583feb5d2ba8e36afe93d08b00ab8db1b36bea7c7fd237e93a6f1 |