'pytest skips test because it depends on another test

In my python unit tests, test_B depends on test_A. However, when I run the tests with pytest, it always SKIPS test_B with this message:

SKIP [1] /home/shuklas/python3.6/site-packages/pytest_dependency.py:88: test_B depends on test_A

What am i missing?

@pytest.mark.dependency()
def test_A():
    ....

@pytest.mark.dependency(depends=['test_A'])
def test_B():
    ....


Solution 1:[1]

Please can you try @pytest.mark.dependency(depends=['A']) and see if it works? Thanks

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ranjit Dhongade