unittest
Python's standard-library xUnit framework. Always there, never exciting.
What it is
unittest ships with Python and follows the classic xUnit shape: test classes, setUp/tearDown, and explicit assertion methods. It includes unittest.mock, which is the standard mocking library used even by pytest suites. Its virtue is that it needs no dependency.
Best for
Where it is strong
- In the standard library — nothing to install or vet.
- unittest.mock is excellent and used almost universally in Python.
- Familiar to anyone coming from JUnit or NUnit.
Where it falls short
- Verbose compared to pytest for the same coverage.
- No parametrisation or fixture composition worth the name.
- Most teams run unittest tests through pytest anyway.
Pricing
Free and open source
Open sourceFree tier: Everything, self-hosted
What drives the bill: Free and open source. You pay in engineering time and CI minutes.
Check current pricing on Python Software Foundation’s siteFigures are indicative and were last reviewed August 2026. Vendors change pricing often; confirm before you commit.
Works with
What people who use unittest say
No reviews of unittest yet. If you have used it in anger, yours would be the first.
Alternatives to unittest
If unittest is not the right fit, these solve the same problem differently.