10 best Python Mock libraries in 2024
by marketing.admin@openweaver.com Updated: Mar 12, 2023
Guide Kit
Mock objects make it possible to write automated tests for code that depends on external services or resources. The most common scenario is when a web application depends on some kind of database. Mocking the database allows you to write tests that check that code that uses the database is operating correctly without actually performing any database operations (which may well be slow or impossible). In this kit, we will discuss the top 8 Python Mock Open Source libraries that you can use in your testing project. moto - easily mock out tests based on AWS infrastructure; responses - A utility for mocking out the Python Requests library; vcrpy - Automatically mock your HTTP interactions.
motoby spulec
A library that allows you to easily mock out tests based on AWS infrastructure.
motoby spulec
Python 6558 Version:Current License: Permissive (Apache-2.0)
responsesby getsentry
A utility for mocking out the Python Requests library.
responsesby getsentry
Python 3895 Version:0.23.1 License: Permissive (Apache-2.0)
vcrpyby kevin1024
Automatically mock your HTTP interactions to simplify and speed up testing
vcrpyby kevin1024
Python 2421 Version:v4.3.1 License: Permissive (MIT)
HTTPrettyby gabrielfalcao
Intercept HTTP requests at the Python socket level. Fakes the whole socket module
HTTPrettyby gabrielfalcao
Python 2039 Version:Current License: Permissive (MIT)
pytest-mockby pytest-dev
Thin-wrapper around the mock package for easier use with pytest
pytest-mockby pytest-dev
Python 1605 Version:v3.10.0 License: Permissive (MIT)
mongomockby mongomock
Small library for mocking pymongo collection objects for testing purposes
mongomockby mongomock
Python 841 Version:4.1.2 License: Others (Non-SPDX)
requests-mockby jamielennox
Mocked responses for the requests library
requests-mockby jamielennox
Python 364 Version:1.10.0 License: Permissive (Apache-2.0)
django-mock-queriesby stphivos
A library for mocking django queryset functions in memory for testing
django-mock-queriesby stphivos
Python 257 Version:v2.2.0 License: Permissive (MIT)
aws-mock-metadataby dump247
Mock EC2 metadata service that can run on a developer machine
aws-mock-metadataby dump247
Python 105 Version:Current License: Permissive (MIT)
mock-alchemyby rajivsarvepalli
SQLAlchemy mock helpers.
mock-alchemyby rajivsarvepalli
Python 57 Version:v0.2.6 License: Permissive (MIT)