{ "info": { "author": "Kevin Marilleau", "author_email": "kevin.marilleau@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Pytest", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Testing" ], "description": "===================\npytest-django-model\n===================\n\n.. image:: https://img.shields.io/pypi/v/pytest-django-model.svg\n :target: https://pypi.org/project/pytest-django-model\n :alt: PyPI version\n\n.. image:: https://img.shields.io/pypi/pyversions/pytest-django-model.svg\n :target: https://pypi.org/project/pytest-django-model\n :alt: Python versions\n\n.. image:: https://travis-ci.org/kmarilleau/pytest-django-model.svg?branch=master\n :target: https://travis-ci.org/kmarilleau/pytest-django-model\n :alt: See Build Status on Travis CI\n\nA Simple Way to Test your Django Models\n\n----\n\nDescription\n-----------\n\nThis plugin allows you to simply test your Django models, by writing your tests\nas you would write your models. On the other hand, pytest-django-model tests\nonly fields, constants, and the Meta inner class. You will have to write tests\nof methods and properties.\n\nThe principle here is not really to test the behavior of your models but rather\nto make sure that the settings are the right ones.\n\nInstallation\n------------\n\nYou can install \"pytest-django-model\" via `pip`_ from `PyPI`_::\n\n $ pip install pytest-django-model\n\n\nUsage\n-----\n\nThe plugin is very easy to use, there are only three things to remember\\:\n\n- The ``PytestDjangoModel`` metaclass.\n- The ``model`` attribute.\n- The ``parents`` attribute (optional).\n\n\nLet's take this model:\n\n.. code-block:: python\n\n class Foo(Bar, Baz):\n class Meta:\n unique_together = (\"name\", \"email\")\n\n FAVORITE_COLOR_CHOICES = (\n (\"BL\", \"blue\"),\n (\"YE\", \"yellow\"),\n (\"GR\", \"green\"),\n (\"RE\", \"red\")\n )\n\n name = models.CharField(max_length=256)\n email = models.EmailField(blank=True)\n\n favorite_color = models.CharField(\n max_length=2, choices=FAVORITE_COLOR_CHOICES, default=\"BL\"\n )\n is_awesome = models.BooleanField(default=True)\n\n\nTo test it, we just have to write this:\n\n.. code-block:: python\n\n from pytest_django_model import PytestDjangoModel\n\n # Name of the test class doesn't matter.\n class TestFoo(metaclass=PytestDjangoModel):\n class Meta:\n model = Foo\n # Parents can be a model or a list/tuple of models.\n parents = (Bar, Baz)\n\n unique_together = (\"name\", \"email\")\n\n FAVORITE_COLOR_CHOICES = (\n (\"BL\", \"blue\"),\n (\"YE\", \"yellow\"),\n (\"GR\", \"green\"),\n (\"RE\", \"red\")\n )\n\n name = models.CharField(max_length=256)\n email = models.EmailField(blank=True)\n\n favorite_color = models.CharField(\n max_length=2, choices=FAVORITE_COLOR_CHOICES, default=\"BL\"\n )\n is_awesome = models.BooleanField(default=True)\n\nAnd voila! We can now launch tests with the command ``pytest``.\n\nFrom there, the class ``PytestDjangoModel`` will generate a fake Django model\nfrom constants, fields and options of the Meta class. This model will inherit\nall the models of the ``parents`` attribute.\n\nThe data of ``Foo`` model and the model created from the ``TestFoo`` class will\nbe extracted and compared. If any constant differs or isn't found, pytest will\nraise a error, same for fields and Meta options.\n\n\nContributing\n------------\nContributions are very welcome. Development Environment can be setup with\n``make setup``. Tests can be run with ``make test``, please ensure the coverage\nat least stays the same before you submit a pull request.\n\nLicense\n-------\n\nDistributed under the terms of the `GNU GPL v3.0`_ license,\n\"pytest-django-model\" is free and open source software.\n\n\nIssues\n------\n\nIf you encounter any problems, please `file an issue`_ along with a detailed\ndescription.\n\n.. _`Cookiecutter`: https://github.com/audreyr/cookiecutter\n.. _`@hackebrot`: https://github.com/hackebrot\n.. _`MIT`: http://opensource.org/licenses/MIT\n.. _`BSD-3`: http://opensource.org/licenses/BSD-3-Clause\n.. _`GNU GPL v3.0`: http://www.gnu.org/licenses/gpl-3.0.txt\n.. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0\n.. _`file an issue`: https://github.com/kmarilleau/pytest-django-model/issues\n.. _`pytest`: https://github.com/pytest-dev/pytest\n.. _`pip`: https://pypi.org/project/pip/\n.. _`PyPI`: https://pypi.org/project", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kmarilleau/pytest-django-model", "keywords": "", "license": "GNU GPL v3.0", "maintainer": "Kevin Marilleau", "maintainer_email": "kevin.marilleau@gmail.com", "name": "pytest-django-model", "package_url": "https://pypi.org/project/pytest-django-model/", "platform": "", "project_url": "https://pypi.org/project/pytest-django-model/", "project_urls": { "Homepage": "https://github.com/kmarilleau/pytest-django-model" }, "release_url": "https://pypi.org/project/pytest-django-model/0.1.9/", "requires_dist": null, "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "summary": "A Simple Way to Test your Django Models", "version": "0.1.9" }, "last_serial": 4821790, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "75d8c06390f484c0a707e921471f82c7", "sha256": "8a7bfab87b466ad76956f75ea130bc2bfbadffe76d41374992447808cf294a09" }, "downloads": -1, "filename": "pytest-django-model-0.1.0.tar.gz", "has_sig": false, "md5_digest": "75d8c06390f484c0a707e921471f82c7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 20756, "upload_time": "2019-01-22T19:20:47", "url": "https://files.pythonhosted.org/packages/de/a5/27942e39b42267c39dde4914b0e9ccbe1541baa9f8a37178a17482cf7b73/pytest-django-model-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "fa2ded51d50ae2d407356eced852a4dc", "sha256": "7c2fa10de55bd519f9cbb59114cb24aaeb5888fe6cf9370ac8be52e94657259f" }, "downloads": -1, "filename": "pytest-django-model-0.1.1.tar.gz", "has_sig": false, "md5_digest": "fa2ded51d50ae2d407356eced852a4dc", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 22881, "upload_time": "2019-01-23T00:23:00", "url": "https://files.pythonhosted.org/packages/71/b2/18d475269c61b1cbaff013e3394bf38f1bfcc475ed66503cbd33dece9fe2/pytest-django-model-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "e601ed4acb6366cc668ceb4fc6a2d7e1", "sha256": "140bc74e6e8a0a13ac228b0a73e913a0c45f72538142673f50aef2ac82807085" }, "downloads": -1, "filename": "pytest-django-model-0.1.2.tar.gz", "has_sig": false, "md5_digest": "e601ed4acb6366cc668ceb4fc6a2d7e1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 23155, "upload_time": "2019-01-23T18:15:05", "url": "https://files.pythonhosted.org/packages/3e/b9/640d00d0ab4f8a14128ae36470583f8eeae89c08760903687a6f6584d57d/pytest-django-model-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "5b650ee358a25d3cde0af591b3e973d5", "sha256": "ba2e190a8b6917ddf249b2711b86355a0e5524f6d46da753489910b2e0a2448b" }, "downloads": -1, "filename": "pytest-django-model-0.1.3.tar.gz", "has_sig": false, "md5_digest": "5b650ee358a25d3cde0af591b3e973d5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 23295, "upload_time": "2019-01-26T01:10:13", "url": "https://files.pythonhosted.org/packages/98/39/dff624dbd73403a659a453fc835910fe216b6593dc01253b26a8071bc0c2/pytest-django-model-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "5ed0030ddd407fe540c90a1eb34b267a", "sha256": "85f0d3074b6cf3401f05a71ae5f6734c72a86cb9d4bad1a5b79a4fc16b4c1cec" }, "downloads": -1, "filename": "pytest-django-model-0.1.4.tar.gz", "has_sig": false, "md5_digest": "5ed0030ddd407fe540c90a1eb34b267a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 23303, "upload_time": "2019-01-26T14:47:21", "url": "https://files.pythonhosted.org/packages/a1/59/db38f8793bfaefc802378f2b46ab8db7b560ff7dd5bd336ba064b1ee7d6d/pytest-django-model-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "9902790bace229652ca42d191b6319d9", "sha256": "361edc27ab1a59fc89a4fffeeda79d566331fb308c3ec6701ae5aa0d6fb535ed" }, "downloads": -1, "filename": "pytest-django-model-0.1.5.tar.gz", "has_sig": false, "md5_digest": "9902790bace229652ca42d191b6319d9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 23306, "upload_time": "2019-01-26T15:02:43", "url": "https://files.pythonhosted.org/packages/98/4c/df33ede4d84327741898e6b4b806b3ceff0162285f0a5596b9b73143ca17/pytest-django-model-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "0143b10693c188ae32705f617247d2e8", "sha256": "3aed15635facf3fd0e530d4b471c425bbcb3d365354de57814e5b3ab31b59d03" }, "downloads": -1, "filename": "pytest-django-model-0.1.6.tar.gz", "has_sig": false, "md5_digest": "0143b10693c188ae32705f617247d2e8", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 23327, "upload_time": "2019-01-26T15:33:14", "url": "https://files.pythonhosted.org/packages/74/3c/5cfab5e1d80d99613b2230290d73fb4dc22df1d8b7b407d08368a4e3fd53/pytest-django-model-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "c85a8774b50b590c6ba79a05ab19ecad", "sha256": "4e3d3cdd046b9ff0e74df47af2872f00f0aff21c68fd1c8cb73cc768f7140b2c" }, "downloads": -1, "filename": "pytest-django-model-0.1.7.tar.gz", "has_sig": false, "md5_digest": "c85a8774b50b590c6ba79a05ab19ecad", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 23426, "upload_time": "2019-01-26T20:14:13", "url": "https://files.pythonhosted.org/packages/6e/2f/e061907c4feb653240560771ef8d8885eaa18ab44e6358f37ba6e79829ca/pytest-django-model-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "bd379dfc0d2e8b1dd35466c8acea0689", "sha256": "90a1d21b1f655d136c2572b77e44125c2d154bba0dce3291ff59d384d4c06815" }, "downloads": -1, "filename": "pytest-django-model-0.1.8.tar.gz", "has_sig": false, "md5_digest": "bd379dfc0d2e8b1dd35466c8acea0689", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 23414, "upload_time": "2019-01-29T01:08:23", "url": "https://files.pythonhosted.org/packages/83/1d/978c1f987b6160fa44cbb762bc269291c04a660712ad55af3bd23ed38ea9/pytest-django-model-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "2a47dd5a10d6ad124d711b2b9324e75a", "sha256": "3783c503b4476385d3ab114ad579514b636f7ea58c0c0f5f58b922d1f8640cdc" }, "downloads": -1, "filename": "pytest-django-model-0.1.9.tar.gz", "has_sig": false, "md5_digest": "2a47dd5a10d6ad124d711b2b9324e75a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 23450, "upload_time": "2019-02-14T19:20:27", "url": "https://files.pythonhosted.org/packages/43/9b/bea8b4395fe7bb07846c5697a5a2954350c017229bfa96625f201bc690f7/pytest-django-model-0.1.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2a47dd5a10d6ad124d711b2b9324e75a", "sha256": "3783c503b4476385d3ab114ad579514b636f7ea58c0c0f5f58b922d1f8640cdc" }, "downloads": -1, "filename": "pytest-django-model-0.1.9.tar.gz", "has_sig": false, "md5_digest": "2a47dd5a10d6ad124d711b2b9324e75a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 23450, "upload_time": "2019-02-14T19:20:27", "url": "https://files.pythonhosted.org/packages/43/9b/bea8b4395fe7bb07846c5697a5a2954350c017229bfa96625f201bc690f7/pytest-django-model-0.1.9.tar.gz" } ] }