Skip to main content

A pytest plugin for motor, the non-blocking MongoDB driver.

Project description


PyPI version PyPI status codecov PyPI pyversions Code style

A pytest plugin for Motor, the non-blocking MongoDB driver.


To install pytest-motor, run:

pip install pytest-motor


from motor.motor_asyncio import AsyncIOMotorClient
import pytest

async def test_using_motor_client(motor_client: AsyncIOMotorClient) -> None:
    """This test has access to a Motor client."""
    await motor_client.server_info()

How it works

When a test session runs, pytest-motor checks that the mongod binary is present in the .mongod subdirectory of the pytest root path. If it is not preset, it will be downloaded. This means that the first run make take some time. Subsequent runs will be faster.

Each test function uses a new motor_client and database. (This may change in the future.)


pytest-motor currently supports:

  • Ubuntu 16.04*, 18.04, and 20.04
  • Debian 9.2* and 10.0*
  • MacOS
  • Windows

*NOT tested.

If you would like support for another system, please make a GitHub Issue. Contributions are welcome!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-motor-0.3.0.tar.gz (6.1 kB view hashes)

Uploaded source

Built Distribution

pytest_motor-0.3.0-py3-none-any.whl (6.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page