python-mocket vs httmock

Python HTTP testing mocks compared

python-mocket and httmock both help Python developers test network-facing code without relying on live services. python-mocket works at the socket and SSL level and supports more than HTTP, while httmock focuses on HTTP calls made through requests.

python-mockethttmock
LanguagePythonPython
LicenseBSD-3-Clause—
Stars311471
Forks5157
Last analyzedOct 3, 2026Oct 19, 2026

Key differences

  • python-mocket patches socket and SSL behavior for HTTP, HTTPS, and lower-level protocols; httmock intercepts HTTP calls made with requests.
  • python-mocket supports synchronous and asynchronous clients, including aiohttp; httmock is built around requests.
  • python-mocket offers strict network blocking and custom socket-level mocks; httmock provides URL-based or catch-all HTTP handlers within a test context.
  • python-mocket is licensed under BSD-3-Clause; httmock's license is reported as NOASSERTION, so review its license files before use.
  • httmock has more reported stars and forks, while its repository is marked inactive with no commits in over a year; python-mocket is not marked archived.

Choose python-mocket if you…

  • need to mock socket traffic beyond requests-based HTTP calls.
  • want strict blocking of unmocked network access or asyncio client support.
  • need to simulate socket errors, record traffic, or build custom protocol mocks.
Read the python-mocket analysis →

Choose httmock if you…

  • use requests and want to mock its HTTP calls with a focused library.
  • want to match requests by URL or intercept all requests in a test context.
  • need to control response status codes, content, headers, and cookies.
Read the httmock analysis →

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.