A mongo mocking library with an ephemeral MongoDB running in memory.
Project description
pymongo_inmemory
A mongo mocking library with an ephemeral MongoDB running in memory.
Installation
pip install pymongo-inmemory
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 poetry.
After installing Pipenv and cloning the repo, create the shell and install all package requirements:
$> poetry install
$> poetry shell
Run the tests:
$> pytest
If on NIX systems you can run further tests:
$> bash tests/integrity/test_integrity.sh
See how you can wet your feet, check out good first issues.
Project details
Release history Release notifications | RSS feed
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.3.tar.gz
(8.4 kB
view hashes)
Built Distribution
Close
Hashes for pymongo_inmemory-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f807a73310aabf4343ac798ea9dade74c2e9b5a754c3fcc24d098af14b81139b |
|
MD5 | 0f6f76092025db3ad39b5f8d64e27391 |
|
BLAKE2b-256 | eb2a8258f07cf93994b25d1f9325942fe8ccdc954476277d229bc4ccd8a02d70 |