pytest-vcr
Plugin for managing VCR.py cassettes
What it is and what it does
pytest-vcr is a pytest plugin that wraps VCR.py to record HTTP interactions during test execution and replay them on subsequent runs. When you annotate a test with @pytest.mark.vcr(), the plugin automatically captures all HTTP requests and responses made by that test into a YAML cassette file, stored alongside your test. On future runs, the plugin replays those recorded interactions instead of making live network calls, making tests faster, more reliable, and independent of external services.
The plugin is designed to be minimal and declarative: you add a decorator to your test, and the cassette management happens automatically. Cassette files are intended to be committed to version control so that all developers and CI systems use the same recorded interactions. The project is in production/stable status but has been abandoned since 2019, meaning it receives no updates for newer Python versions or pytest features.
Use it for:
- Record HTTP interactions during development and replay them in CI to avoid flaky tests caused by network timeouts or external service changes.
- Test code that calls third-party APIs without requiring valid credentials or network access during test runs.
- Ensure deterministic test behavior by replaying the same HTTP responses across all environments and developers.
- Reduce test suite runtime by eliminating network latency from HTTP-dependent tests.
- Audit and version-control the exact HTTP exchanges your code makes, useful for debugging and compliance.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that integrates VCR.py to record and replay HTTP interactions in tests, eliminating the need for live network calls during test runs.
Yes, if your tests rely on HTTP calls and you're running on Python versions up to 3.7 with compatible pytest versions. The plugin is simple and does its job well. However, be aware it is abandoned—no maintenance since 2019—so if you need compatibility with modern Python or pytest, or if you encounter bugs, you may need to fork it or switch to an alternative. For stable, long-running projects on older Python stacks, it remains a solid choice.
Install
pytest-vcr on PyPI
pip
pip install pytest-vcruv
uv add pytest-vcrpoetry
poetry add pytest-vcrInstalling pytest-vcr
Before you install
Low friction install with two straightforward runtime dependencies (pytest and vcrpy). However, the project is abandoned—last release was April 2019 and last commit May 2022—so expect no maintenance, bug fixes, or compatibility updates for newer Python or pytest versions.
License in practice
MIT license is permissive; you can use this in commercial or proprietary projects with minimal restrictions, provided you retain the license notice.
Quickstart
pip install pytest-vcr
# In your test file:
import pytest
from urllib.request import urlopen
@pytest.mark.vcr()
def test_example():
response = urlopen('http://www.example.com').read()
assert b'Example' in response
Requires pytest and vcrpy to be installed; relies on pytest's marker system, so pytest must be your test runner.
Verify before relying
- Compatibility with pytest versions released after 2019 and Python 3.8+.
- Whether cassette format remains compatible with recent vcrpy releases.
- Active maintenance status or community forks that may have continued development.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pytest, vcrpy |
| Maintenance | abandoned — 2,667 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,292,932/month — #3,160 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_vcr-1.0.2-py2.py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
keboola.vcrRecords, sanitizes, and validates HTTP…
permissive · top 15,000 on PyPI
pytest-recordingA pytest plugin that records and replays HTTP…
permissive · top 5,000 on PyPI
vcrpyVCR.py records HTTP interactions during test…
permissive · top 1,000 on PyPI
betamaxBetamax records and replays HTTP interactions…
permissive · top 15,000 on PyPI
asciinemaRecords and replays terminal sessions, saving…
copyleft · top 5,000 on PyPI
pytest-replayA pytest plugin that records test execution…
permissive · top 15,000 on PyPI
pytest-mockProvides a pytest fixture that wraps the mock…
permissive · top 1,000 on PyPI
pytest-progressA pytest plugin that displays real-time test…
permissive · top 15,000 on PyPI
pytest-datadirA pytest plugin that provides fixtures for…
permissive · top 5,000 on PyPI
pytest-xprocesspytest-xprocess manages external processes…
permissive · top 15,000 on PyPI