pytest

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

Framework
PyPI
v9.1.1
14,428stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
96/100Excellent
Development Activity100
Maintenance96
Community88
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
89/100Excellent
Architecture90
Code Quality92
Innovation88
Learning Curve85

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 93 apps in this directory

Python
66%
Apache 2.0

Agent Control

AI Agents

295

An open-source runtime control plane for AI agents — define safety guardrails once, apply them across agents built on LangChain, CrewAI, Google ADK, or AWS Strands, and update controls without redeploying code.

View details
79
Repo Health
71
Technical
70
Dependency
Built with
Python66%
TypeScript33%
Updated yesterday
Python
100%
Apache 2.0

Agno

Devops · AI Development · Automation

41,774

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
67
Dependency
Built with
Python100%
Updated today
Python
49%
Other

Airbyte

Developer Tools · Data Engineering

21,916

Open-source ELT platform with 600+ connectors for moving data from any source to warehouses, lakes, and AI agents.

View details
95
Repo Health
80
Technical
67
Dependency
Built with
Python49%
Kotlin42%
Updated today
Python
90%
Apache 2.0

Apache Airflow

Data Engineering

46,530

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
66
Dependency
Built with
Python90%
Updated today
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,081

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
65
Repo Health
81
Technical
63
Dependency
Built with
Python59%
Jupyter Notebook21%
Updated 2 days ago
Python
88%
Apache 2.0

ART

AI Development

10,603

Give your LLM agents on-the-job training—ART lets you apply GRPO reinforcement learning to any multi-step agentic workflow with minimal code changes.

View details
85
Repo Health
82
Technical
72
Dependency
Built with
Python88%
Cuda10%
Updated today
Python
52%
MIT

Auto Company

AI Agents · Automation

2,273

A 24/7 autonomous AI company: 14 expert-persona agents running on Claude Code or Codex CLI that research, decide, code, deploy, and market real products with a single markdown file as their only memory.

View details
41
Repo Health
51
Technical
72
Dependency
Built with
Python52%
TypeScript17%
Shell14%
Updated 3 months ago
Python
62%
MIT

AutoGen

AI Development · Automation

60,518

Build autonomous and human-in-the-loop multi-agent AI systems with a layered, event-driven Python and .NET framework pioneered at Microsoft Research.

View details
57
Repo Health
78
Technical
75
Dependency
Built with
Python62%
C#25%
TypeScript12%
Updated 4 months ago
Python
68%
Other

AutoGPT

Automation · Productivity · AI Assistants

186,687

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
67
Dependency
Built with
Python68%
TypeScript31%
Updated today

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

Search