Use fixtures within pytest.mark.parameterize

I have a pytest fixture that produces an iterable and I would like to parameterize a test using the items in this iterable, but I cannot figure out the correct syntax. Does anyone know how to parametrize a test using the values of a fixture? Here is some dummy code that shows my current approach:

import pytest

@pytest.fixture()
def values():
    return [1, 1, 2]

@pytest.mark.parametrize('value', values)
def test_equal(value):
    assert value == 1



Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)