You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pytest-order breaks the fixture scope for parametrized fixtures #48
@pytest.fixture(params=[1, 2], scope="class")defnumber(request):
print(f"setup number {request.param}")
yieldrequest.paramprint(f"teardown number {request.param}")
@pytest.mark.usefixtures("number")classTestClass:
@pytest.mark.order(2)deftest1(self):
pass@pytest.mark.order(1)deftest2(self):
pass
the test fixture will be called twice instead of once for each parameter. Removing the order markers fixes this.
The same happens for session scope.
I'm not entirely sure how the correct behavior should be. Without the ordering, with the class scope the tests are reordered so that all tests with the same parameter are run consecutively - this allows the class scope to work.
With ordering, it propably shall behave the same, e.g. the ordering shall happen for each parameter separately.
Activity
mrbean-bremen commentedon Jul 24, 2021
This is actually expected behavior - I'm going to convert this to a discussion.