Skip to content

Multiple calls to parametrize result in empty value lists not skipping the test #510

Closed
tjamet/caduc
#4
@pytestbot

Description

@pytestbot

Originally reported by: Alex Stapleton (BitBucket: private, GitHub: private)


If you call parametrize on a test more than once for different arguments of the test it doesn't seem to combine the parameters correctly if some of them are empty. This results in tests that would normally get skipped because their parametisation is missing values receiving the internal _notset sentinel object for that fixture.

Examples here https://gist.github.com/public/e671a53b70fbb6fb6129

The last example is the simplest reproduction of the problem.

This does not get skipped and fixP is _notset.

@pytest.mark.parametrize(["fixP"], [(1,)])
@pytest.mark.parametrize(["fixQ"], [])
def test_fixA_fixB_bad2(fixP, fixQ):
    print fixP, fixQ

but if you swap the order of the calls to parametrize...

@pytest.mark.parametrize(["fixQ"], [])
@pytest.mark.parametrize(["fixP"], [(1,)])
def test_fixA_fixB_bad2(fixP, fixQ):
    print fixP, fixQ

it skips as you would expect from reading the documentation.

I've reproduced this on 2.5.2 and on the current master 2.6 branch.


Metadata

Metadata

Labels

topic: parametrizerelated to @pytest.mark.parametrizetype: bugproblem that needs to be addressedtype: regressionindicates a problem that was introduced in a release which was working previously

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions