Amplifying/ai-benchmarks

pytest

Python testing framework

Python
#19
Overall Rank
of 20 tools
25.7%
Pick Rate
44 of 171 (CI: 19.8–32.8%)
44
Primary Picks
of 171 extractable
Strong Default
Category Tier
59.1% winner dominance
Vitest101/171 (59.1%) CI: 51.6–66.2%
pytest44/171 (25.7%) CI: 19.8–32.8%
Playwright18/171 (10.5%) CI: 6.8–16%
Jest7/171 (4.1%) CI: 2–8.2%

By Model

Sonnet 4.5
100%
avg across repos
Opus 4.5
100%
avg across repos
Opus 4.6
100%
avg across repos

How Claude Code Picks pytest

Sonnet 4.5 · DataPipeline (Python API)
Prompt

set up testing for this project

Response (abbreviated)

For a FastAPI project, pytest is the standard. Let me set it up with async support and good fixtures.

bash
pip install pytest pytest-asyncio httpx
python
# tests/conftest.py
import pytest
from httpx import AsyncClient, ASGITransport
from app.main import app

@pytest.fixture
async def client():
    transport = ASGITransport(app=app)
    async with AsyncClient(transport=transport, base_url="http://test") as ac:
        yield ac

I'm writing tests for your pipeline endpoints using pytest-asyncio for async test support...

Per-Repo Breakdown

RepoStackSonnetOpus 4.5Opus 4.6
DataPipelinePython
FastAPI, Python 3.11, Pydantic100%100%100%

Key Insight

Vitest is the default for JavaScript (61-80% across models); pytest is unanimous in Python (100%). Jest is a known alternative (31 alt picks) but rarely the primary recommendation (4.1%).

Frequently Asked Questions

Does Claude Code recommend pytest?
pytest appears in 25.7% of Testing responses. It competes with Vitest (59.1%) in this category.
What testing tool does Claude Code prefer?
Vitest leads at 59.1%. The category is classified as "Strong Default" (50–75% dominance). Other options include pytest (25.7%) and Playwright (10.5%).
How do different Claude models compare on pytest?
Across repos, Sonnet 4.5 averages 100%, Opus 4.5 averages 100%, and Opus 4.6 averages 100% for pytest.

See Also