pytest
PronunciationPY-test
Definition
pytest is the most popular Python testing framework. It finds test functions automatically, uses plain assert, and offers fixtures, parametrization and plugins.
Where you hear it
In Python project READMEs, CI scripts (pytest -q), and job descriptions for Python backend roles.
Examples
Run
pytest -k paymentto run only the payment tests.pytest rewrites assert so failures show both values.
pytest reports which test failed and shows the values that did not match.
Common mistake
Naming files or functions so pytest can't find them. By default it looks for test_*.py and test_* functions.
Don't confuse with
unittest, the framework built into Python. It is more verbose and class-based.
Say it at work
- In a meeting or chat
Add pytest to the dev dependencies.
- In an email or ticket
CI runs pytest on every push.
Keep exploring
More in Testing & Quality