test collection

The step where pytest searches files and names to decide which tests exist before running any of them.

In more detail

By default pytest collects files named test_*.py or *_test.py, functions whose names start with test at module level, and classes named Test* with no __init__. Anything else is imported but never run, so a misnamed test silently disappears; watch the collected count in the header.

Related terms

Taught in

References