I'm trying to improve the test collection speed by including the testpaths option in the pytest.ini file.
Inside each App folder I have a tests
file where I put my tests, so I'm including it as follows:
[pytest]
testpaths = tests
However, no tests are collected. It returns the error: ERROR: file or directory not found: tests
What I'm I missing?
testpaths
should be relative to the project root, so if you have a subdirectoryapp1/tests
, thentestpaths = tests
won't work. Do a configuration per-app and place onepytest.ini
withtestpaths = tests
in each of your app directories. – Anselmaapp1/tests
is not specified. If I settestpaths = tests
, pytest catch all tests in./*/tests/test_*.py
subdirectories. – Chenoweth