--- id: pytest-recording version: "0.13.4" license: MIT license_treatment: permissive maintenance: active --- # pytest-recording — A pytest plugin powered by VCR.py to record and replay HTTP traffic License: permissive · Maintenance: active · Downloads: 6.1M/mo ## What it is and what it does pytest-recording is a pytest plugin that integrates vcrpy to record HTTP interactions during test runs and replay them on subsequent runs. Instead of mocking HTTP responses manually or hitting live APIs in tests, you decorate test functions with @pytest.mark.vcr and the plugin automatically captures requests and responses into YAML cassette files, then replays them without network access. This makes tests faster, more reliable, and independent of external services. The plugin offers straightforward configuration through pytest marks and fixtures, supports combining multiple cassettes, can block network access entirely to prevent accidental live requests, and includes a rewrite mode to regenerate cassettes from scratch. It integrates with vcrpy's full API, allowing custom matchers, persisters, and fine-grained control over what gets recorded and filtered. Use it for: - Test code that calls external APIs without making real network requests during CI/CD runs - Record API responses once, then run tests offline or in isolated environments - Prevent tests from failing due to external service downtime or rate limiting - Block network access globally to catch unintended HTTP calls in your test suite - Filter sensitive headers or query parameters from cassettes before committing them to version control ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A pytest plugin that records and replays HTTP traffic using VCR.py, letting you test code that makes network requests without hitting the network every time. Yes. This is a well-maintained, actively developed plugin with no security issues, low install friction, and a clear use case for any project testing code that makes HTTP requests. The permissive MIT license poses no barrier. Install it if you want to replace live API calls or manual mocks with recorded cassettes in pytest. ## Install pip install pytest-recording uv add pytest-recording poetry add pytest-recording ## Installing pytest-recording Before you install: Low friction install with just two runtime dependencies (pytest and vcrpy). Actively maintained with recent commits and no known vulnerabilities. Supports Python 3.9 through 3.13. License in practice: MIT license is permissive; you can use this in commercial projects with minimal restrictions. Quickstart: pip install pytest-recording import pytest @pytest.mark.vcr def test_api_call(): # Your test code that uses pytest and vcrpy pass # Run with: pytest --record-mode=once test_file.py Requires pytest and vcrpy as runtime dependencies. Default recording mode is 'none' to prevent unintentional network requests; you must pass --record-mode=once (or another mode) to pytest to allow recording on first run. Verify before relying: - Whether the plugin works with pytest fixtures beyond vcr_config and the vcr cassette object itself - Performance characteristics when replaying large cassette files or many simultaneous tests - Exact HTTP status codes or response assertions supported in decorated test functions ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 6.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest http mocking vcr, record replay http requests, pytest network cassettes, vcr pytest plugin, http traffic recording tests, mock http responses pytest, network isolation testing, http-mocking, test-isolation, vcr-integration [View on SkillFed](https://skillfed.io/packages/pytest-recording) · [View on PyPI](https://pypi.org/project/pytest-recording/)