pytest

The Python testing framework that makes writing small tests easy and scales to complex functional test suites.

Framework
PyPI
v9.1.1
14,543 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
96 /100 Excellent
Development Activity 100
Maintenance 96
Community 88
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
89 /100 Excellent
Architecture 90
Code Quality 92
Innovation 88
Learning Curve 85

pytest is the de facto standard testing framework for Python, built around plain assert statements, detailed assertion introspection, and automatic test discovery so developers never need to remember self.assert* method names. Its modular fixture system (dependency injection for setup/teardown, resource management, and parametrization) combined with a pluggy-based hook architecture has made it the foundation for a plugin ecosystem of over 1,300 third-party extensions covering everything from coverage reporting to async support.

Beyond unit tests, pytest can run existing unittest and trial suites without modification, making it a practical drop-in upgrade path for legacy codebases. It is maintained by the pytest-dev organization on GitHub with a large, active contributor base and is used across the Python ecosystem from small libraries to major frameworks and data-science stacks.

What You Get

  • Automatic test discovery across modules, classes, and functions using configurable naming conventions
  • A fixture system for dependency injection, resource setup/teardown, and test parametrization at function, class, module, or session scope
  • Assertion rewriting that gives detailed introspection on plain assert failures, no custom assertion API required
  • A pluggy-based hook architecture (hookspec.py) letting plugins add CLI options, collection behavior, and reporting
  • Built-in compatibility running existing unittest and trial test suites unmodified
  • A rich plugin ecosystem of 1,300+ third-party extensions (coverage, xdist parallelization, async, mocking, and more)

Common Use Cases

  • Unit and functional testing for Python libraries and applications, from small scripts to large monorepos
  • Migrating legacy unittest-based test suites incrementally without rewriting existing tests
  • Parametrized and property-style testing via fixtures combined with plugins like hypothesis
  • Parallel and distributed test execution in CI pipelines via the pytest-xdist plugin
  • Building custom testing tools and plugins on top of pytest’s hook and fixture APIs

Under The Hood

Architecture pytest’s execution flow starts in src/_pytest/config/__init__.py (2,333 lines), which parses CLI arguments and pytest.ini/pyproject.toml config, builds a Config object, and initializes the pluggy PluginManager. Collection and test running are driven from src/_pytest/main.py, which walks the filesystem to discover test modules/classes/functions, then hands each collected item to src/_pytest/runner.py for the setup/call/teardown protocol. The fixture system, implemented in src/_pytest/fixtures.py (2,598 lines), resolves fixture dependency graphs per test, honoring scope (function/class/module/session) and finalizers. Extensibility runs through src/_pytest/hookspec.py (1,298 lines), which declares the full set of hook specifications (pytest_collect_file, pytest_runtest_protocol, etc.) that both pytest’s own internal plugins (assertion rewriting, capture, logging, doctest, and 20+ others under src/_pytest/) and third-party plugins implement via the pluggy library. Tech Stack The project is pure Python (99.99% of the codebase per GitHub’s language breakdown), targeting Python 3.10+ and PyPy3, with a minimal runtime dependency set: pluggy (the hook/plugin engine), iniconfig and packaging for config parsing, pygments for terminal syntax highlighting, plus conditional colorama (Windows), exceptiongroup, and tomli backports for older Python versions. Packaging uses setuptools with setuptools-scm for git-tag-based versioning; dependency locking for development uses uv.lock. Code Quality The testing/ directory contains 155+ test files exercising pytest’s own internals (a large self-hosted test suite, since pytest tests itself using pytest), alongside changelog/ entries enforced per-PR via a towncrier-style process. The codebase is fully type-annotated (ships a py.typed marker for both the pytest and _pytest packages) and enforces style via pre-commit.ci. Its extremely long-lived, incremental development history (17,585+ commits since 2015, ~88 commits/month recently) with a stable core team suggests high day-to-day code review rigor. API Design pytest’s public API is intentionally minimal: pytest.fixture, pytest.mark, pytest.raises, and plain assert cover the overwhelming majority of test-writing needs, with almost zero required boilerplate to get a first test running (def test_x(): assert ... is a complete, valid test file). The fixture-injection model (declaring a fixture as a test function parameter) is widely regarded as one of the more ergonomic dependency-injection patterns in the Python ecosystem, and the CLI (pytest) auto-discovers tests with no configuration required for the common case.

Used by 100 apps in this directory

TypeScript
98%
Apache 2.0

rowboat

AI Assistants · AI Development

17,983

Build, test, and deploy multi-agent AI workflows with a visual editor, RAG data sources, MCP tool integration, and a production-ready REST API.

View details
85
Repo Health
72
Technical
65
Dependency
Built with
TypeScript 98%
Updated 2 weeks ago
TypeScript
65%
MIT

Scalar

Developer Tools

16,198

Beautiful, interactive OpenAPI documentation with a built-in offline-first API client and multi-language code generation — all in one open-source platform.

View details
90
Repo Health
89
Technical
65
Dependency
Built with
TypeScript 65%
Vue 30%
Updated 1 weeks ago
Python
76%
Apache 2.0

Second Me

AI Assistants · Productivity

15,690

Train a locally hosted AI twin on your own memories—then connect it to the world through a decentralized identity network.

View details
41
Repo Health
75
Technical
67
Dependency
Built with
Python 76%
TypeScript 19%
Updated 1 years ago
TypeScript
50%
Other

SigNoz

Analytics · Monitoring

32,224

Self-host your entire observability stack — logs, metrics, traces, and LLM monitoring — in one OpenTelemetry-native platform, without the Datadog bill.

View details
92
Repo Health
83
Technical
67
Dependency
Built with
TypeScript 50%
Go 38%
Updated 1 weeks ago
Python
94%
BSD 3

skrub

Developer Tools

1,653

Turn messy real-world dataframes into machine learning features — no manual wrangling required.

View details
86
Repo Health
84
Technical
80
Dependency
Built with
Python 94%
Updated 2 weeks ago
Rust
77%
Apache 2.0

SlateDB

Databases · Developer Tools

3,448

Embedded KV store built on object storage with zero replication cost

View details
87
Repo Health
73
Technical
72
Dependency
Built with
Rust 77%
Updated 2 weeks ago
Python
94%
MIT

Stealth Browser MCP

Developer Tools · Mcp

2,156

An MCP server giving AI agents real, undetectable browser automation — built on nodriver and Chrome DevTools Protocol to navigate sites protected by Cloudflare and other anti-bot systems for automation and testing workflows.

View details
69
Repo Health
66
Technical
73
Dependency
Built with
Python 94%
Updated 2 weeks ago
TypeScript
54%
MIT

supermemory

AI Development · AI Memory · Note Taking

30,958

The state-of-the-art memory and context engine for AI agents — ranked #1 on all three major AI memory benchmarks.

View details
87
Repo Health
82
Technical
68
Dependency
Built with
TypeScript 54%
MDX 31%
Python 13%
Updated 2 weeks ago
Python
67%
Apache 2.0

SurfSense

AI Assistants · Search

16,270

The open-source, unlimited NotebookLM alternative with real-time collaboration, a desktop app, and no vendor lock-in.

View details
87
Repo Health
71
Technical
66
Dependency
Built with
Python 67%
TypeScript 30%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers