pytest
pytest is the de facto standard test runner for Python: plain functions with assert, detailed failure reports, fixtures, parametrization and a large plugin ecosystem.
Not checked by a trusted editor yet Last edited Outdated?
pytest-dev/pytest
- Stars
- 14.6k
- Forks
- 3.5k
- Language
- Python
- Licence
- MIT
- Last push
- 13 Oct 2026
On GitHub: The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
Open on GitHubpytest discovers test files and functions by naming convention, runs them, and rewrites ordinary assert statements so a failure shows the actual values involved. Its fixture system handles setup and teardown through function parameters, and built-ins such as tmp_path, monkeypatch and capsys cover common needs without extra code. It can also run existing unittest test cases, which makes migrating an older project gradual.
Use it for any Python project that has tests, from a single script to a large application. Plugins extend it for coverage reports (pytest-cov), running tests in parallel (pytest-xdist), async code and web frameworks. Configuration lives in pyproject.toml under [tool.pytest.ini_options].
The repository holds the source, the changelog and the issue tracker; the full documentation is at docs.pytest.org. For a hands-on start, see the article “Testing with pytest: first tests, fixtures and parametrize”.
See also
- 0006 Testing with pytest: first tests, fixtures and parametrize pytest runs plain functions whose names start with test_ and reports every failing assert in detail. This guide covers setup, assertions, exceptions,… Intermediate · How-to · Any system Article Testing 15 Oct 2026
- 0261 Build a Python command-line to-do app: from empty folder to installable command Create a small to-do tool in Python with argparse and JSON storage, test it with pytest and package it with pyproject.toml so… Beginner · Tutorial · Any system Article Environments & packages · Files & automation · Testing 15 Oct 2026
History
Every saved edit is kept. The plot on the sleeve draws one line per edit. Open any edit to see exactly what changed.
- Commitpedia +934 chars