Overview
pytest
works by automatically detect new tests inside folders.
By convention, it will detect any of the test starts with test_
or end with _test
For example, if your folder structure is like this:
├── src
│ ├── __init__.py
│ ├── __pycache__
│ └── main.py
└── tests
├── __init__.py
├── __pycache__
└── main_test.py
When running pytest
at the root folder. It will automatically Collect the relevant tests and execute it.
[!note]
The__init__.py
file here is for Python Module