python-pytest-cases icon indicating copy to clipboard operation
python-pytest-cases copied to clipboard

`@parametrize` with new **kwargs style leads to a counter-intuitive fixture closure (but still runs all tests correctly)

Open smarie opened this issue 5 years ago • 0 comments
trafficstars

This is a minor issue as it seems to have no impact on the tests run.

Passing all parameters in the same parametrization, where at least one of them is a fixture_ref

@parametrize(u=(fixture_ref(a), fixture_ref(c)), i=['x', 'z'])
def b(u, i):
    pass

is not strictly equivalent to

@parametrize(i=['x', 'z'])
@parametrize(u=(fixture_ref(a), fixture_ref(c)))
def b(u, i):
    pass

In the first situation, parametrize will remove all parameters from the signature and create one single parametrized fixture b_u_i parametrized with the cartesian product of u and i.

In the second situation, the parametrize concerning u will remove u from the signature and create a parametrized fixture b_u, but will let i in place and parametrize it directly as usual.

smarie avatar Jul 29 '20 10:07 smarie