I have the following tests directory tree:
tests/
subfolder_1/
test_1.py
subfolder_2/
subsubfolder/
subsubsubfolder/
test_2.py
py.test only finds test_1.py. How can I make it find test_2.py?
pytest always searches recursively unless you tell it otherwise (with the norecursedirs option).
If pytest is failing to collect some of your tests, double check that:
testpaths configuration pattern (default: the current directory),python_files configuration pattern (default: test_*.py and *_test.py),python_classes configuration pattern (default: Test*), andpython_functions configuration pattern (default: test*).Pytest has some issues finding files named test.py or similar. Try giving it a more specialised name such as test_subfolder1.py and test_subfolder2.py or so. Also make sure that all you folders are packages i.e. have __init__.py file in them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With