materialsproject / fireworks

The Fireworks Workflow Management Repo.
https://materialsproject.github.io/fireworks
Other
363 stars 185 forks source link

Optionally use mongomock instead of pymongo/mongodb #520

Closed ikondov closed 5 months ago

ikondov commented 9 months ago

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:

Todos

If this is work in progress, what else needs to be done?

Checklist

Tip: Install pre-commit hooks to auto-check types and linting before every commit:

pip install -U pre-commit
pre-commit install
ikondov commented 6 months ago

Before merging some developer should maybe have a look at this test. The latter test and this test had identical function names so that the first test has never run in the CI. And only after I changed the names it was selected by pytest but failed. This is why I marked it to be skipped.

ikondov commented 6 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.

computron commented 5 months ago

Hi, this is just a quick apology that this hasn't been reviewed yet. I promise to do so before the end of June!

computron commented 5 months ago

Merged - thanks for contributing this!

ikondov commented 4 months ago

@computron Thanks a lot for considering, reviewing and merging!