Skip to content

Ordering breaking with pytest-xdist + pytest-dependency #71

@hnandiwada

Description

@hnandiwada

Hi,
I have the following test code:

class BaseTest:
   ...

    @pytest.mark.dependency(name="one", depends=["zero"])
    def test_one(self, fixtures...):
        ...

    @pytest.mark.dependency(name="two", depends=["one"])
    def test_two(self, fixtures...):
        ...

    @pytest.mark.dependency(name="three", depends=["two"])
    def test_three(self, fixtures...):
        ...

    @pytest.mark.dependency(name="zero")
    def test_zero(self, fixtures...):
        ...

Other tests inherit from the BaseTest. Every class has its own file.

class TestSomething(BaseTest):
    @pytest.fixture(scope="module")
    def something(self):
        return "something"

I've been running python3 -m pytest -s --order-dependencies -ra -v --dist=loadfile -n auto.

The first ordering works well - zero runs before one for every class that inherits the test. But, for some reason, pytest-order is consistently putting test_three before test_two (except for one class in particular - not sure if this is a red herring or not). I'm not sure if this is a bug or some behavior that I don't understand. I can confirm the order that the tests are being run in in the verbose output. Everything runs correctly when running without xdist: python3 -m pytest -s --order-dependencies -ra -v -k something.
Happy to share more details privately if they would help.
Thanks for maintaining such a useful plugin!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions