-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
This came up in a StackOverflow question. In the following code:
@pytest.fixture(params=[1, 2], scope="class")
def number(request):
print(f"setup number {request.param}")
yield request.param
print(f"teardown number {request.param}")
@pytest.mark.usefixtures("number")
class TestClass:
@pytest.mark.order(2)
def test1(self):
pass
@pytest.mark.order(1)
def test2(self):
passthe 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.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working