Skip to main content

Pymongo Mocking Tool with in memory MongoDB running.

Project description

pymongo_inmemory

A mongo mocking library with an ephemeral MongoDB running in memory.

Usage

Insert a new section to your project's setup.cfg for the operating system and mongo version you want to spin up:

[pymongo_inmemory]
mongo_version = 4.0
operating_system = osx

then use the pymongo_inmemory client instead of original one:

from pymongo_inmemory import MongoClient

client = MongoClient()  # No need to provide host
db = client['testdb']
collection = db['test-collection']
# etc., etc.
client.close()

# Also usable with context manager
with MongoClient() as client:
    # do stuff

Development

Project is set up to develop with Pipenv.

After installing Pipenv and cloning the repo, create the shell and install all package requirements:

$> pipenv shell
$> pipenv install --dev

Create your own setup.cfg file from setup.cfg-template.

Run the tests:

$> pytest

If on NIX systems you can run further tests:

$> bash tests/integrity/test_integrity.sh

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

pymongo_inmemory-0.1.2.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

pymongo_inmemory-0.1.2-py3-none-any.whl (8.5 kB view hashes)

Uploaded Python 3

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