VCR.py is a Python library that automatically records and replays HTTP interactions to simplify and speed up testing.
The library solves the problem of slow, flaky, or network-dependent tests by intercepting HTTP requests and recording them to cassette files on first run. When tests execute again, VCR.py replays the recorded responses instead of making actual network calls. This approach eliminates external dependencies, makes tests deterministic, and accelerates test execution. The cassettes are stored as YAML files by default, and if an API changes, developers can simply delete the cassette files and re-run tests to capture the new interactions.
VCR.py suits projects that make HTTP requests in their test suites and want to avoid network calls during testing. It works through context managers or function decorators and supports multiple HTTP libraries. The tool is particularly valuable for teams working offline or needing reliable, fast test runs. For pytest users, the pytest-recording library provides fixtures that integrate VCR.py with pytest workflows.
The project maintains active development with regular updates to its test suite and continuous integration checks. The codebase includes comprehensive documentation and maintains code coverage tracking. Community engagement is supported through a Gitter chat channel for user discussion and questions.