mongomock-motor
Library for mocking AsyncIOMotorClient built on top of mongomock.
Decision gist · record as of 2026-08-14
Yes, if you write async MongoDB code with motor and want to test without a real database. The low install friction, permissive license, and current Python version support make it a straightforward addition to a test suite. The aging maintenance status (455 days since last release) is a minor concern for a stable mock library, but the lack of security vulnerabilities and active repository suggest it remains usable. Verify that the mock covers the specific motor APIs your code relies on before committing to it.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later; async/await syntax required in calling code.
- Low install friction with a pure-Python wheel.
- Maintenance status is aging—last release was 455 days ago—but the repository is not archived and the package supports current Python versions through 3.13.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use this package freely in commercial and open-source projects with minimal restrictions.
last release 2025-05-16 (455 days) · last repo commit 2025-05-16 · 123 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,467,915 downloads/mo, #3,873 on PyPI
Alternatives
Verify before relying
pip install mongomock-motor
from mongomock_motor import AsyncMongoMockClient
async def test():
collection = AsyncMongoMockClient()['db']['collection']
await collection.insert_one({'a': 1})
docs = await collection.find({}).to_list(None)
return docs- Completeness of AsyncIOMotorClient API coverage—which methods and features are fully mocked vs. stubbed or missing.
- Performance characteristics and suitability for large test datasets or high-volume mock operations.
- Known limitations or edge cases where mock behavior diverges from actual Motor/MongoDB behavior.
What it is and what it does
mongomock-motor wraps the mongomock library to provide an async-compatible mock of MongoDB's AsyncIOMotorClient. It lets you write and test async MongoDB code without spinning up a real database server, using the same async/await patterns you'd use with the actual motor library. The mock implements the core AsyncIOMotorClient, Database, and Collection interfaces, returning coroutines that can be awaited in your test code.
The package is built on top of mongomock, which handles the in-memory database simulation, and motor, which defines the async API contract. It's intended for unit and integration testing of applications that use motor for async MongoDB access. Since it's a pure-Python implementation with no external database dependency, it's fast and lightweight for test environments.
Use it for
- Unit test async MongoDB code without requiring a test MongoDB instance or Docker container.
- Mock motor client in CI/CD pipelines where spinning up a database would slow down test runs.
- Develop and test async MongoDB queries locally without database setup overhead.
- Verify async query logic and collection operations in isolation before integration testing.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you write async MongoDB code with motor and want to test without a real database.
The low install friction, permissive license, and current Python version support make it a straightforward addition to a test suite. The aging maintenance status (455 days since last release) is a minor concern for a stable mock library, but the lack of security vulnerabilities and active repository suggest it remains usable. Verify that the mock covers the specific motor APIs your code relies on before committing to it.
Install
mongomock-motor on PyPI
Before you install
Low install friction with a pure-Python wheel. Maintenance status is aging—last release was 455 days ago—but the repository is not archived and the package supports current Python versions through 3.13.
Requires Python 3.8 or later; async/await syntax required in calling code.
License in practice
MIT license is permissive; you can use this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install mongomock-motor
from mongomock_motor import AsyncMongoMockClient
async def test():
collection = AsyncMongoMockClient()['db']['collection']
await collection.insert_one({'a': 1})
docs = await collection.find({}).to_list(None)
return docs
Verify before relying
- Completeness of AsyncIOMotorClient API coverage—which methods and features are fully mocked vs. stubbed or missing.
- Performance characteristics and suitability for large test datasets or high-volume mock operations.
- Known limitations or edge cases where mock behavior diverges from actual Motor/MongoDB behavior.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <4.0,>=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesmongomockmotor |
| Maintenance | Aging 455 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,467,915 / month, #3,873 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: mongomock_motor-0.0.36-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “async mongodb mock”
- mongomock-motorProvides an async mock client for MongoDB that mimics the…
- mongomockMongomock provides an in-memory mock of MongoDB collections for…
- pydantic-mongoProvides a Repository pattern for MongoDB with Pydantic model…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also mongomock · motor · motor-types · django-mock-queries · asyncmock · odmantic · pymongo_inmemory · Flask-PyMongo · moto-ext · aioresponses