pytest-responses
py.test integration for responses
Decision gist · record as of 2026-08-14
Yes. This is a lightweight, actively maintained plugin that solves a common testing problem—network isolation—with minimal friction. Low dependency count, permissive license, and no known vulnerabilities make it a safe addition to test suites. Install it if your tests make HTTP requests and you want to mock them reliably.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low friction install with only two runtime dependencies (responses and pytest).
- Actively maintained with a recent release; last commit 2026-06-29 and repository not archived.
License · maintenance · safety
Apache 2.0 (permissive) — Licensed under Apache 2.0 (permissive), so you can use it freely in commercial and open-source projects without significant legal constraints.
last release 2026-06-29 (46 days) · last repo commit 2026-06-29 · 94 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 203,099 downloads/mo, #9,635 on PyPI
Alternatives
Verify before relying
pip install pytest-responses
import pytest
from responses import RequestsMock
def test_with_responses(responses):
responses.add(responses.GET, 'http://example.com', json={'key': 'value'})
# Your test code here- Whether the package works with all versions of the responses library or has specific version constraints.
- Whether the withoutresponses marker and responses fixture can be used together in the same test suite.
What it is and what it does
pytest-responses is a pytest plugin that integrates the responses HTTP mocking library into your test suite, automatically activating request interception across all tests by default. This prevents accidental network calls during testing and ensures your tests remain isolated and deterministic.
The plugin provides two main ways to control mocking: a responses fixture you can inject into test functions, and a withoutresponses marker to disable mocking for specific tests that genuinely need external network access. It depends on responses and pytest, both widely used testing tools, so integration into existing test workflows is straightforward.
Use it for
- Prevent accidental HTTP requests in unit tests by automatically mocking all network calls.
- Test code that makes external API calls without hitting real endpoints or rate limits.
- Verify that your application makes the correct HTTP requests with the right parameters and headers.
- Run tests in isolated environments (CI/CD, offline) without network dependencies.
- Selectively disable mocking for integration tests that need real network access using the withoutresponses marker.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a lightweight, actively maintained plugin that solves a common testing problem—network isolation—with minimal friction. Low dependency count, permissive license, and no known vulnerabilities make it a safe addition to test suites. Install it if your tests make HTTP requests and you want to mock them reliably.
Install
pytest-responses on PyPI
Before you install
Low friction install with only two runtime dependencies (responses and pytest). Actively maintained with a recent release; last commit 2026-06-29 and repository not archived.
Requires Python 3.9 or later.
License in practice
Licensed under Apache 2.0 (permissive), so you can use it freely in commercial and open-source projects without significant legal constraints.
Quickstart
pip install pytest-responses
import pytest
from responses import RequestsMock
def test_with_responses(responses):
responses.add(responses.GET, 'http://example.com', json={'key': 'value'})
# Your test code here
Verify before relying
- Whether the package works with all versions of the responses library or has specific version constraints.
- Whether the withoutresponses marker and responses fixture can be used together in the same test suite.
Package facts
| License | Apache 2.0 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesresponsespytest |
| Maintenance | Actively maintained 46 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 203,099 / month, #9,635 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Framework :: PytestIntended Audience :: DevelopersIntended Audience :: System AdministratorsOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Topic :: Software Development |
Evidence: pytest_responses-0.6.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytest http mocking”
- pytest-responsesAutomatically mocks HTTP requests across your pytest test suite using…
- pytest-httpxpytest-httpx provides a pytest fixture that intercepts httpx requests…
- pytest-localserverProvides pytest fixtures that spin up local HTTP and SMTP servers for…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also httmock · pytest-subprocess · responses · pytest_httpserver · pytest-httpx2 · urllib3-mock · aresponses · mocket · pytest-localserver · requests-mock