--collect-only
A pytest option that lists every test it would run without running any of them.
In more detail
It is the fastest way to check that a test you expect is actually collected, and to read the suite's names as a specification. Combined with -q it prints one node ID per line.
Example
pytest -q --collect-only test_names.pyRelated terms
- test collection — The step where pytest searches files and names to decide which tests exist before running any of them.
- node ID — The full address pytest gives each test, made of the file path, two colons and the test name, such as test_discount.py::test_a_silly_percentage_is_refused.
- test naming — Choosing test function names that state the behaviour and the condition, so a failure summary reads as a sentence.
Taught in
- Naming Tests For Readability — Automated Testing, TDD & Quality Engineering