A mongo mocking library with an ephemeral MongoDB running in memory.
Low maintenance activity. Last release 21 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
Consider insteadpytest-mongoPythie’s Index: 8127.2K downloads/moCompare →
pip install pymongo-inmemory[ PyPI ][ GitHub ][ BETA Docs]
pymongo_inmemory
A mongo mocking library with an ephemeral MongoDB running in memory.
What's new?
v0.5.0
- Fixed default fallback for storage engine for mongo versions > 6. by @davidwaroquiers in [PR #119]
- Adding support for mongo 8 by @timjnh in [PR #123]
v0.4.0
- Tooling enhancements. [PR #90]
- Configuration for data directory. [PR #90]
- Configuration for data directory. [PR #90]
v0.3.1
- Development version upped to Python 3.9
- Update to build system. Contribution by @pbsds
- Coercing boolean configs correctly. Issue #82
Installation
pip install pymongo-inmemory
Usage
Configure
There are several ways you can configure pymongo_inmemory.
- Insert a new section titled
pymongo_inmemoryto your project'ssetup.cfgversion you want to spin up:[pymongo_inmemory] operating_system = ubuntu os_version = 18 mongod_port = 27019 - Define an
ALL_CAPSenvironment variables with prefixPYMONGOIM__(attention to trailing double underscores.) For instance, to override the port, set up an environment variablePYMONGOIM__MONGOD_PORT.
Import and use
pymongo_inmemory wraps the client class MongoClient that comes from pymongo and configures with an ephemeral MongoDB server.
You can import this from instead of and use it to perform tests: