--- id: mongomock-motor version: "0.0.36" license: MIT license_treatment: permissive maintenance: aging --- # mongomock-motor — Library for mocking AsyncIOMotorClient built on top of mongomock. License: permissive · Maintenance: aging · Downloads: 1.5M/mo ## 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 above — verify before relying. Provides an async mock client for MongoDB that mimics the AsyncIOMotorClient API, allowing you to test async MongoDB code without a running database. 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 pip install mongomock-motor uv add mongomock-motor poetry add mongomock-motor ## Installing mongomock-motor 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. 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 Requires Python 3.8 or later; async/await syntax required in calling code. 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_current - Install friction: low - Maintenance: aging - Downloads: 1.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags async mongodb mock, motor client testing, mongodb async mock, asyncio motor mock, mongodb test double, mock asyncio motor client, mongodb unit testing, testing, mongodb, async-mock [View on SkillFed](https://skillfed.io/packages/mongomock-motor) · [View on PyPI](https://pypi.org/project/mongomock-motor/)