How to execute single dependent test using pytest

360 views Asked by At

I want to execute a single test that is dependent on another test. Let's say for the purpose of the question I have the following tests and one of them is depending on another test. I am using pytest-dependency.

class TestClass:

    @pytest.mark.dependency()
    def test_one(self):
        pass

    @pytest.mark.dependency(depends=["TestClass::test_one"])
    def test_two(self):
        pass

When I run the whole suite everything is working perfectly, but when I try to execute only the test test_one it always skips because the first test is not passed. Shouldn't the first test be executed in this case too?

0

There are 0 answers