Closed ikondov closed 5 months ago
Regarding the two tests in core/tests/tests_launchpad.py
that fail with mongomock: They rely on a condition when the maximum document size (16 MB) is reached to trigger storage of the FWAction object in gridfs. But this does not occur with mongomock because it does not raise the DocumentTooLarge
exception. This is why I marked the test with mongodb
.
Hi, this is just a quick apology that this hasn't been reviewed yet. I promise to do so before the end of June!
Merged - thanks for contributing this!
@computron Thanks a lot for considering, reviewing and merging!
Summary
Optionally replacing the mongodb database with a mocked (embedded) database can ease testing and tutorials for novice users. See this thread for more information.
We have performed an evaluation of several different solutions and have selected mongomock. A special package including the data persistence option to mongomock was created and included to the requirements.
Major changes:
pymongo.MongoClient
withmongomock_persistence.MongoClient
if the environment variable$MONGOMOCK_SERVERSTORE_FILE
is set or the key MONGOMOCK_SERVERSTORE_FILE in FW_Config file is set. This happens centrally infw_config.py
.pytest_mongomock
has been added for the mongomock environment has been added. The original CI jobpytest
was only renamed topytest_mongodb
and not changed. All tests are selected in thepytest_mongodb
job.mongodb
have been added to all these tests. These 13 tests are deselected in thepytest_mongomock
CI job.Todos
If this is work in progress, what else needs to be done?
Checklist
ruff
.mypy
.duecredit
@due.dcite
decorators to reference relevant papers by DOI (example)Tip: Install
pre-commit
hooks to auto-check types and linting before every commit: