--- id: pytest-responses version: "0.6.0" license: Apache 2.0 license_treatment: permissive maintenance: active --- # pytest-responses — py.test integration for responses License: permissive · Maintenance: active · Downloads: 203.1K/mo ## 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 above — verify before relying. Automatically mocks HTTP requests across your pytest test suite using the responses library, preventing real network calls during testing. 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 pip install pytest-responses uv add pytest-responses poetry add pytest-responses ## Installing pytest-responses 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. 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 Requires Python 3.9 or later. 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_current - Install friction: low - Maintenance: active - Downloads: 203.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest http mocking, mock http requests in tests, pytest responses integration, disable network requests pytest, fake http responses testing, pytest network isolation, http-mocking, test-isolation [View on SkillFed](https://skillfed.io/packages/pytest-responses) · [View on PyPI](https://pypi.org/project/pytest-responses/)