I'm currently working on a Python project and using pytest for testing. I have structured my project to include tests in separate directories, and I'm trying to use a pyproject.toml
file to specify the paths where pytest should discover the test files. However, it seems like pytest is not recognizing some of the paths specified in the pyproject.toml
file.
Here is what my pyproject.toml
file looks like:
[tool.pytest.ini_options]
python_paths = ["src", "tests", "tests/Google-Calendar", "tests/Reclaim", "tests/Todoist"]
I expected pytest to discover and run tests in all the specified directories, but it's not running the tests in "tests/Google-Calendar"
, "tests/Reclaim"
, and "tests/Todoist"
. When I run pytest
all the tests run fine however I want to run them separately by doing pytest filename
but instead I can only do pytest (absolute path to file)
.
Things I've tried:
- Checked that the paths are correct and the directories exist.
- Ensured that the test files follow the pytest naming conventions (
test_*.py
or*_test.py
).
I'm not sure what I'm missing here. Has anyone experienced a similar issue or can provide some insight into what might be going wrong and how to fix it?