A JavaScript API mocking library that intercepts network requests in browsers and Node.js, so app code runs unchanged while tests and development use mock responses.
kevin1024/vcrpy
A Python library that records HTTP interactions made during tests and replays them later, so tests run offline and deterministically.
- Stars
- 3,023
- Forks
- 448
- Open issues
- 32
- Last commit
- 4 days ago
What is it?
VCR.py is a Python port of Ruby's VCR library. Wrap a test or code path in a context manager or decorator, and the first run records every HTTP interaction made through supported libraries into a flat file called a cassette, serialized as YAML by default. Later runs read the cassette and return the recorded responses for matching requests instead of hitting the network.
This removes the dependency on live servers, so tests can run offline, produce the same results every time, and finish faster. When a remote API changes, deleting the cassette and rerunning the tests re-records the interactions against the new behavior. A companion library, pytest-recording, provides pytest fixtures for working with VCR.py.
Key features
- 01Records HTTP requests and responses into YAML cassette files by default
- 02Replays recorded responses so tests make no real network traffic
- 03Works as a context manager or decorator around test code
- 04Supports offline and deterministic test runs
- 05Pairs with pytest-recording for pytest fixtures
Use cases
- Running API client tests without network access or a live staging server
- Making test suites deterministic by removing flaky external responses
- Speeding up CI by replaying previously recorded HTTP calls
- Updating recorded API responses after a remote service changes
In collections
Topics
FAQ
- What is vcrpy?
- A Python library that records HTTP interactions made during tests and replays them later, so tests run offline and deterministically. VCR.py is a Python port of Ruby's VCR library. Wrap a test or code path in a context manager or decorator, and the first run records every HTTP interaction made through supported libraries into a flat file called a cassette, serialized as YAML by default. Later runs read the cassette and return the recorded responses for matching requests instead of hitting the network.
- Is vcrpy free to use? What license does it have?
- vcrpy is open source under the MIT license. Check the license terms before using it in commercial products.
- Is vcrpy still maintained?
- Actively maintained. The last commit to vcrpy was on Nov 3, 2026.
- What can I use vcrpy for?
- Running API client tests without network access or a live staging server Making test suites deterministic by removing flaky external responses Speeding up CI by replaying previously recorded HTTP calls Updating recorded API responses after a remote service changes
- Where can I get vcrpy?
- The source code and installation instructions are on GitHub: https://github.com/kevin1024/vcrpy
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Jest is a JavaScript testing framework with built-in assertions, mocking, snapshot testing and an interactive watch mode.
GoogleTest is Google's C++ testing and mocking framework, providing xUnit-style tests, rich assertions, and GoogleMock.
A Go testing toolkit providing assertions, mocks, and a suite structure that works with the standard go test runner.
A pytest plugin that runs tests in parallel across multiple CPUs and adds a loop-on-failures mode.
A pytest plugin that lets test functions be coroutines, so you can await asyncio code directly inside tests.