Testing in Python

20 projects in Developer Tools. Most starred: selenium, locust and faker.

pytest is the default for new projects: plain assert statements, fixtures for setup, parametrized tests and a large plugin ecosystem. It also runs tests written for the standard library's unittest. Hypothesis adds property-based testing: you describe the inputs, it generates many cases and shrinks any failure to a minimal example. Robot Framework uses keyword-driven tests that non-programmers can read, which suits acceptance testing. tox and nox run your suite across Python versions and environments; nox is configured in Python rather than INI.

For isolation, unittest.mock patches objects in the standard library, responses mocks the Requests library, RESPX mocks HTTPX, VCR.py records real HTTP interactions and replays them, and time-machine controls the current time. factory_boy and Polyfactory build test objects, with Polyfactory generating them from type hints on dataclasses and Pydantic models. Faker and Mimesis generate realistic fake data, and Coverage.py measures what your tests exercise.

For browsers, Playwright drives Chromium, Firefox and WebKit with automatic waiting, Selenium is the long-standing WebDriver standard, and SeleniumBase wraps Selenium with extra helpers. Locust writes load tests as Python code, and Schemathesis generates API tests from OpenAPI and GraphQL schemas. Playwright is the usual pick for new end-to-end suites because its automatic waiting removes most flaky sleeps, and it includes a pytest plugin. Selenium remains the choice when you need a WebDriver grid or browsers Playwright does not drive.

Deeper lists: awesome-pytest

Frameworks3

pytest

A mature full-featured Python testing tool.

14.6kupdated today9.1.1

hypothesis

Hypothesis is an advanced Quickcheck style property based testing library.

9.1kupdated today6.170.9

robotframework

A generic test automation framework.

12kupdated 1d ago7.5

Test Runners2

tox

Auto builds and tests distributions in multiple Python versions.

4kupdated today4.67.1

nox

Flexible test automation for Python.

1.6kupdated 4d ago2026.10.20

Browser Automation3

playwright-python

Python version of the Playwright testing and automation library.

15.1kupdated today1.64.1

selenium

Python bindings for Selenium WebDriver.

34.6kupdated todayselenium-4.51.0

seleniumbase

Python framework for web automation & testing, with stealth options.

13.1kupdated 3d ago4.56.3

Load Testing1

locust

Scalable user load testing tool written in Python.

28.2kupdated today2.47.0

API Testing1

schemathesis

Automatic property-based testing of web APIs from OpenAPI or GraphQL schemas.

3.7kupdated today4.32.4

Mock5

responses

A utility library for mocking out the requests Python library.

4.3kupdated 18d ago0.26.3

vcrpy

Record and replay HTTP interactions on your tests.

3kupdated 4d ago8.3.0

respx

Mock HTTPX with awesome request patterns and response side effects.

841updated 3mo ago0.23.1

time-machine

Travel through time in your tests by mocking the current time at the C level.

1kupdated 2d ago

Object Factories2

factory-boy

A test fixtures replacement for Python.

3.8kupdated 9mo ago

polyfactory

A mock data generation library based on type hints (continuation of pydantic-factories).

1.5kupdated today3.5.0

Code Coverage1

coverage

Code coverage measurement.

3.4kupdated today7.17.0

Fake Data2

faker

A Python package that generates fake data.

19.5kupdated 15d ago40.43.0

mimesis

A Python library for generating fake but realistic data in multiple languages and locales.

4.9kupdated 18d ago22.2.0
Esc

Type to search every entry. ↑↓ to move, Enter to open.