Skip to main content

Pymongo Mocking Tool with in memory MongoDB running.

Project description

pymongo_inmemory

A mongo mocking library with MongoDB running in memory.

Usage

Insert a new section to your projwects setup.cfg for operating system and mongo version:

[pymongo_inmemory]
mongo_version = 4.0
operating_system = osx

then use the in-memory client insstead 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

TODO

  • Move portfinding of Mongod to constructor to avoid possible port clashes between module load and object creation.
  • Clean up and centralize config acquisition, env var>pim.ini>setup.cfg
  • Add atexit register for mongod clean up
  • Add module level docs where needed. Also function level docs for public API
  • Add github docs, vuepress
  • Ability to define folders through config (env overwrites)
  • Wire ability to overwrite conf through env
  • Increase test coverage
  • Add static type checking
  • Remove PIPE output from mongod

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.1.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

pymongo_inmemory-0.1.1-py3-none-any.whl (7.7 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