Repolode
kevin1024

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