vcrpy vs python-mocket
Python network testing tools compared
vcrpy records HTTP interactions in cassette files and replays matching responses in later test runs. python-mocket patches socket and SSL behavior to mock HTTP and other protocol traffic, with options for strict network blocking and asynchronous clients.

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.

python-mocket: Mock Socket Traffic for Python Tests
Mocket lets Python developers intercept socket and SSL traffic so tests can mock HTTP and other protocol clients without making real network requests. It supports synchronous and asynchronous clients, strict network blocking, and custom socket-level mocks.
| vcrpy | python-mocket | |
|---|---|---|
| Language | Python | Python |
| License | MIT | BSD-3-Clause |
| Stars | 3k | 311 |
| Forks | 444 | 51 |
| Last analyzed | Oct 3, 2026 | Oct 3, 2026 |
Key differences
- vcrpy focuses on recording and replaying HTTP interactions, while python-mocket can mock HTTP, HTTPS, and lower-level socket protocols.
- vcrpy stores recorded interactions in cassette files, using YAML by default; python-mocket can record real socket traffic to JSON files.
- python-mocket offers strict mode to raise an exception for unmocked network access, while vcrpy replay uses requests matching saved cassette interactions.
- python-mocket supports asyncio clients, including aiohttp, and custom socket-protocol mocks; vcrpy's described use centers on supported HTTP client libraries.
- vcrpy is licensed under MIT and has 3k stars; python-mocket is licensed under BSD-3-Clause and has 311 stars.
Choose vcrpy if you…
- need to replay recorded HTTP responses from cassette files in later test runs.
- want tests to run without HTTP traffic after recording the required interactions.
- use a supported HTTP library and want to refresh fixtures by recording interactions again.
Choose python-mocket if you…
- need to mock socket traffic beyond HTTP, including custom protocols.
- want strict mode to catch unmocked network access in tests.
- test asyncio clients or need to simulate socket errors and connection failures.
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.