vcrpy vs httmock
Python HTTP testing libraries compared
vcrpy records HTTP interactions to cassette files and replays them in later test runs. httmock intercepts requests made through `requests` and returns responses configured for the test, so the main difference is replaying recorded traffic versus defining mocked responses.

vcrpy: Replay HTTP Interactions in Tests
VCR.py records HTTP interactions to cassette files and replays matching responses in later test runs. It helps Python developers make network-dependent tests faster, deterministic, and usable offline after recording.

httmock: Mock HTTP Requests for Python Tests
httmock is a Python library built on requests for mocking HTTP interactions in tests. It lets you provide conditional or catch-all mocked responses when testing code that calls APIs through requests.
| vcrpy | httmock | |
|---|---|---|
| Language | Python | Python |
| License | MIT | — |
| Stars | 3k | 471 |
| Forks | 444 | 57 |
| Last analyzed | Oct 3, 2026 | Oct 19, 2026 |
Key differences
- vcrpy records real HTTP interactions on an initial run; httmock supplies mocked responses without contacting live services.
- vcrpy replays matching requests from cassette files, with YAML as its default format; httmock uses URL-matching decorators or handlers active in an `HTTMock` context.
- vcrpy supports HTTP traffic through libraries it supports; httmock is designed specifically for the `requests` library.
- httmock lets tests configure response status codes, content, headers, and cookies; vcrpy returns saved responses from recorded interactions.
- vcrpy is listed with an MIT license and 3k stars; httmock is listed with license `NOASSERTION` and 472 stars.
Choose vcrpy if you…
- need to replay recorded HTTP interactions from cassette files.
- want tests to run offline after recording the required interactions.
- need to refresh test fixtures by recording interactions again.
Choose httmock if you…
- want to define mocked responses for requests made through `requests`.
- need to configure response status, content, headers, or cookies in tests.
- want to match selected URLs while leaving unmatched requests unaffected by conditional matching.
Compare the numbers side by side, or add more projects
This comparison is generated with AI from the OSRepos analyses of both projects. Always check each project's repository and documentation before choosing.