Automatically run dependencies for pytest
We have pytests with dependencies. When I run an individual test, it returns an error that the dependency was not run. Is there a configuration option to run the depedency test instead of returning an error?
e.g.
@pytest.mark.dependency(depends=["test_setup"])
def test_A():
…
When I run just test_A, I get the error message test_setup has not been run.
Instead, I would prefer pycharm to run test_setup
I know I can change the run configuration of test_A, but I would prefer this to be a global setting rather than have to change each test.
Thanks.
请先登录再写评论。
That is a really good question. I have the same problem.
Tried to reproduce the error using the dependency example from pytest, but it seems to work as expected if I run single tests from the batch.
Could you please share a simplified version of your project so we can test that?