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.
Please sign in to leave a comment.
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?
I have the same issue and find it very inconvenient. You can easily reproduce it by just running only
test_bResult: [pytest_dependency:100]: skip test_b because it depends on a
PyCharm 2024.3.1.1 Build #PC-243.22562.220, built on December 18, 2024