{ "info": { "author": "Martin Domke", "author_email": "mail@martindomke.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Database", "Topic :: Software Development :: Libraries" ], "description": ".. image:: https://img.shields.io/pypi/v/pytest-mongodb.svg\n :target: https://pypi.python.org/pypi/pytest-mongodb\n.. image:: https://travis-ci.org/mdomke/pytest-mongodb.svg?branch=master\n :target: https://travis-ci.org/mdomke/pytest-mongodb\n.. image:: https://img.shields.io/pypi/l/pytest-mongodb.svg\n :target: https://pypi.python.org/pypi/pytest-mongodb\n\nWhat is this?\n=============\n\nThis is a pytest_ plugin, that enables you to test your code that relies on a\ndatabase connection to a MongoDB and expects certain data to be present.\nIt allows you to specify fixtures for database collections in JSON/BSON or YAML\nformat. Under the hood we use the mongomock_ library, that you should\nconsult for documentation on how to use MongoDB mock objects. If suitable you\ncan also use a real MongoDB server.\n\n**Note**: This project has been renamed from ``humongous`` to ``pytest-mongodb`` in order\nto conform to the pytest plugin naming convention and to be easier to find on the\nPython package index. See the `migration section `_ for more information.\n\n\nConfiguration\n-------------\n\nIf you don't want to put your database fixtures on the top-level directory of your package\nyou have to specify a directory where ``pytest-mongodb`` looks for your data definitions.\n\nTo do so put a line like the following under the ``pytest`` section of your\n``pytest.ini``-file put a\n\n.. code-block:: ini\n\n [pytest]\n mongodb_fixture_dir =\n tests/unit/fixtures\n\n``pytest-mongodb`` would then look for files ending in ``.yaml`` or ``.json`` in that\ndirectory.\n\nYou can also choose to use a real MongoDB server for your tests. In that case\nyou might also want to configure the hostname and/or the credentials if you\ndon't want to stick with the default (localhost and no credentials). Use the\nfollowing configuration values in your ``pytest.ini`` to adapt the settings to\nyour needs:\n\n.. code-block:: ini\n\n [pytest]\n mongodb_engine = pymongo\n mongodb_host = mongodb://user:passwd@server.tld\n mongodb_dbname = mydbname\n\n\nBasic usage\n-----------\n\nAfter you configured ``pytest-mongodb`` so that it can find your fixtures you're ready to\nspecify some data. Regardless of the markup language you choose, the data is provided\nas a list of documents (dicts). The collection that these documents are being inserted\ninto is given by the filename of your fixture-file. E.g.: If you had a file named\n``players.yaml`` with the following content:\n\n.. code-block:: yaml\n\n -\n name: Mario\n surname: G\u00f6tze\n position: striker\n\n -\n name: Manuel\n surname: Neuer\n position: keeper\n\n\nyou'd end up with a collection ``players`` that has the above player definitions\ninserted. If your fixture file is in JSON/BSON format you can also use BSON specific\ntypes like ``$oid``, ``$date``, etc.\n\n\nYou get ahold of the database in your test-function by using the ``mongodb`` fixture\nlike so:\n\n.. code-block:: python\n\n def test_players(mongodb):\n assert 'players' in mongodb.collection_names()\n manuel = mongodb.players.find_one({'name': 'Manuel'})\n assert manuel['surname'] == 'Neuer'\n\n\nFor further information refer to the mongomock_ documentation.\n\nIf you want to skip specific tests if the engine is ie. a mongomock engine you could do that\nlike so:\n\n\n.. code-block:: python\n\n from pytest_mongodb.plugin import mongo_engine\n from pytest import mark\n\n @mark.skipif(mongo_engine() == 'mongomock', reason=\"mongomock does not support that\")\n def test_players(mongodb):\n assert 'players' in mongodb.collection_names()\n manuel = mongodb.players.find_one({'name': 'Manuel'})\n assert manuel['surname'] == 'Neuer'\n\nMigration from humongous\n------------------------\n\nIn the course of migrating the package name from ``humongous`` to ``pytest-mongodb`` most\nconfiguration values which previously were prefixed with ``humongous_`` have been\nrenamed to a ``mongodb_``-prefixed counterpart. The only notable exception is the\n``humongous_basedir`` config value, which now is named ``mongodb_fixture_dir``.\nAdditionally the commandline options have been unified, in a way that multi-word option\nnames are now consistently separated with dashes instead of underscores.\n\n\n\n.. _mongomock: https://github.com/vmalloc/mongomock\n.. _pytest: https://docs.pytest.org/en/latest/\n\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mdomke/pytest-mongodb", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pytest-mongodb", "package_url": "https://pypi.org/project/pytest-mongodb/", "platform": "", "project_url": "https://pypi.org/project/pytest-mongodb/", "project_urls": { "Homepage": "https://github.com/mdomke/pytest-mongodb" }, "release_url": "https://pypi.org/project/pytest-mongodb/2.1.2/", "requires_dist": [ "mongomock", "pymongo", "pyyaml", "pytest (>=2.5.2)" ], "requires_python": "", "summary": "pytest plugin for MongoDB fixtures", "version": "2.1.2" }, "last_serial": 3366236, "releases": { "2.0.0.dev3": [], "2.0.1": [ { "comment_text": "", "digests": { "md5": "c306d6afcaa2d4d52b588b6254c20df2", "sha256": "71d5eef0746ebe23619b600304672abdafe6fe5c7db1d35ab96e0705cbbba6a0" }, "downloads": -1, "filename": "pytest_mongodb-2.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c306d6afcaa2d4d52b588b6254c20df2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6829, "upload_time": "2016-01-22T11:53:21", "url": "https://files.pythonhosted.org/packages/12/03/bea7266169a3f71eeed195f27e448cede4db9ed137b7f0d0e946f80f38d2/pytest_mongodb-2.0.1-py2.py3-none-any.whl" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "0429339d98b70f8060cb645e3d4a2b78", "sha256": "34ffa4c4de6e6793d64dcb3ab06ba7f96c4ffe761fe07b6efa7c4629f6857ea0" }, "downloads": -1, "filename": "pytest_mongodb-2.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0429339d98b70f8060cb645e3d4a2b78", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7318, "upload_time": "2016-01-25T11:18:01", "url": "https://files.pythonhosted.org/packages/90/e1/de51fec1c40a2238da2171f59cde68c915b3548636d97848639eb63cc281/pytest_mongodb-2.0.2-py2.py3-none-any.whl" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "14ded131f5bc983728ec61f559600f99", "sha256": "bb70483004c2cac7d16e03bec4710b5a18679c88a0b990c1be6508020092b050" }, "downloads": -1, "filename": "pytest_mongodb-2.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "14ded131f5bc983728ec61f559600f99", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7592, "upload_time": "2017-04-29T10:53:17", "url": "https://files.pythonhosted.org/packages/b3/57/bf78f66843b0dd8a9372ba8fea3c1deb3ff249a4f9861566995b449e78fb/pytest_mongodb-2.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e432d9c83a2e9b214378c771762a82bb", "sha256": "5ce8d57d85f41beccc46ee3594e6df082f9679f157bba1f1111b679340a69b56" }, "downloads": -1, "filename": "pytest-mongodb-2.1.0.tar.gz", "has_sig": false, "md5_digest": "e432d9c83a2e9b214378c771762a82bb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8009, "upload_time": "2017-04-29T10:53:19", "url": "https://files.pythonhosted.org/packages/0f/82/6ca6e35b8163b4cbdbcd01ccf0bebb2955f58f9d089d72cf0cf269c837f8/pytest-mongodb-2.1.0.tar.gz" } ], "2.1.1": [ { "comment_text": "", "digests": { "md5": "eb8f00dd006c36fbc5479ab57a0f84d0", "sha256": "67e7226edd5f0a837c5920046dd42af19a95b62c4518117e7330bb8b7651f272" }, "downloads": -1, "filename": "pytest_mongodb-2.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "eb8f00dd006c36fbc5479ab57a0f84d0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7645, "upload_time": "2017-07-22T08:22:57", "url": "https://files.pythonhosted.org/packages/ad/ab/bf31de733982d190a3e566d28ecf9bc283ec335652a353a5b36920f6b0c9/pytest_mongodb-2.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "63af08ede84be78a2ec4a651c6ea0ac1", "sha256": "5ed7962ec8d8a4628657e1f3cffd8527ca5abdf1b5d702fdc641b63fd81fb5dd" }, "downloads": -1, "filename": "pytest-mongodb-2.1.1.tar.gz", "has_sig": false, "md5_digest": "63af08ede84be78a2ec4a651c6ea0ac1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8049, "upload_time": "2017-07-22T08:23:00", "url": "https://files.pythonhosted.org/packages/f0/77/53af6e0e6922883d8395d06eebbb712a864c8d3b09e020bc6cf2e55af8f5/pytest-mongodb-2.1.1.tar.gz" } ], "2.1.2": [ { "comment_text": "", "digests": { "md5": "474382970c37b7143c6ad98082ff5ba7", "sha256": "df71d8ea6d730075eacc8909f4bfa56738dbcb7adce4b8c758b6c72e47a34471" }, "downloads": -1, "filename": "pytest_mongodb-2.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "474382970c37b7143c6ad98082ff5ba7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7684, "upload_time": "2017-11-26T23:02:57", "url": "https://files.pythonhosted.org/packages/6d/26/4d11715867fefcb48462fbb1810bd30e1ba95aa995884b4ba7f3cdb503f8/pytest_mongodb-2.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2931c76a53f50fc1db6e2b88d8b9cedf", "sha256": "6b0d5c3adcfbfb4dd8fea49dc60c4012e6da68e15e28471c7e7082268129b6f6" }, "downloads": -1, "filename": "pytest-mongodb-2.1.2.tar.gz", "has_sig": false, "md5_digest": "2931c76a53f50fc1db6e2b88d8b9cedf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8156, "upload_time": "2017-11-26T23:02:58", "url": "https://files.pythonhosted.org/packages/65/56/43699e516e1659ab0ea23eb0a313ecff17218a514ad967d9f3c64b7739bb/pytest-mongodb-2.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "474382970c37b7143c6ad98082ff5ba7", "sha256": "df71d8ea6d730075eacc8909f4bfa56738dbcb7adce4b8c758b6c72e47a34471" }, "downloads": -1, "filename": "pytest_mongodb-2.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "474382970c37b7143c6ad98082ff5ba7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7684, "upload_time": "2017-11-26T23:02:57", "url": "https://files.pythonhosted.org/packages/6d/26/4d11715867fefcb48462fbb1810bd30e1ba95aa995884b4ba7f3cdb503f8/pytest_mongodb-2.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2931c76a53f50fc1db6e2b88d8b9cedf", "sha256": "6b0d5c3adcfbfb4dd8fea49dc60c4012e6da68e15e28471c7e7082268129b6f6" }, "downloads": -1, "filename": "pytest-mongodb-2.1.2.tar.gz", "has_sig": false, "md5_digest": "2931c76a53f50fc1db6e2b88d8b9cedf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8156, "upload_time": "2017-11-26T23:02:58", "url": "https://files.pythonhosted.org/packages/65/56/43699e516e1659ab0ea23eb0a313ecff17218a514ad967d9f3c64b7739bb/pytest-mongodb-2.1.2.tar.gz" } ] }