{ "info": { "author": "Conner Swann", "author_email": "me@connerswann.me", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Pytest", "Intended Audience :: Developers", "Operating System :: OS Independent", "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 :: Software Development :: Libraries" ], "description": "PySnap |travis| |pypi|\n============================\n\nNote: This project is just a fork of the package ``snapshottest`` which lives here: https://github.com/syrusakbary/snapshottest. It had been mostly abandoned, so I kicked the wheels and got it back in working order. Contributions are welcome!\n\nSnapshot testing is a way to test your APIs without writing actual test\ncases.pip install doc8\n\n1. A snapshot is a single state of your API, saved in a file.\n2. You have a set of snapshots for your API endpoints.\n3. Once you add a new feature, you can generate *automatically* new\n snapshots for the updated API.\n\n.. code:: html\n\n

\n\n.. code:: html\n\n

\n\nInstallation\n------------\n\n::\n\n $ pip install pysnap\n\nUsage with unittest/nose\n------------------------\n\n.. code:: python\n\n from pysnap import TestCase\n\n class APITestCase(TestCase):\n def test_api_me(self):\n \"\"\"Testing the API for /me\"\"\"\n my_api_response = api.client.get('/me')\n self.assertMatchSnapshot(my_api_response)\n\n # Set custom snapshot name: `gpg_response`\n my_gpg_response = api.client.get('/me?gpg_key')\n self.assertMatchSnapshot(my_gpg_response, 'gpg_response')\n\nIf you want to update the snapshots automatically you can use the\n``nosetests --snapshot-update``.\n\nCheck the `Unittest\nexample `__.\n\nUsage with pytest\n-----------------\n\n.. code:: python\n\n def test_mything(snapshot):\n \"\"\"Testing the API for /me\"\"\"\n my_api_response = api.client.get('/me')\n snapshot.assert_match(my_api_response)\n\n # Set custom snapshot name: `gpg_response`\n my_gpg_response = api.client.get('/me?gpg_key')\n snapshot.assert_match(my_gpg_response, 'gpg_response')\n\nIf you want to update the snapshots automatically you can use the\n``--snapshot-update`` config.\n\nCheck the `Pytest\nexample `__.\n\nUsage with django\n-----------------\n\nAdd to your settings:\n\n.. code:: python\n\n TEST_RUNNER = 'pysnap.django.TestRunner'\n\nTo create your pysnap:\n\n.. code:: python\n\n from pysnap.django import TestCase\n\n class APITestCase(TestCase):\n def test_api_me(self):\n \"\"\"Testing the API for /me\"\"\"\n my_api_response = api.client.get('/me')\n self.assertMatchSnapshot(my_api_response)\n\nIf you want to update the snapshots automatically you can use the\n``python manage.py test --snapshot-update``. Check the `Django\nexample `__.\n\nContributing\n============\n\nAfter cloning this repo, ensure dependencies are installed by running:\n\n.. code:: sh\n\n pip install -e \".[test]\"\n\nAfter developing, the full test suite can be evaluated by running:\n\n.. code:: sh\n\n py.test\n\nNotes\n=====\n\nThis package is heavily insipired in `jest snapshot\ntesting `__.\n\nReasons for use this package\n============================\n\n Most of this content is taken from the `Jest snapshot\n blogpost `__.\n\nWe want to make it as frictionless as possible to write good tests that\nare useful. We observed that when engineers are provided with\nready-to-use tools, they end up writing more tests, which in turn\nresults in stable and healthy code bases.\n\nHowever engineers frequently spend more time writing a test than the\ncomponent itself. As a result many people stopped writing tests\naltogether which eventually led to instabilities.\n\nA typical snapshot test case for a mobile app renders a UI component,\ntakes a screenshot, then compares it to a reference image stored\nalongside the test. The test will fail if the two images do not match:\neither the change is unexpected, or the screenshot needs to be updated\nto the new version of the UI component.\n\nSnapshot Testing with PySnap\n----------------------------------\n\nA similar approach can be taken when it comes to testing your APIs.\nInstead of rendering the graphical UI, which would require building the\nentire app, you can use a test renderer to quickly generate a\nserializable value for your API response.\n\nLicense\n-------\n\n`MIT\nLicense `__\n\n|coveralls|\n\n.. |travis| image:: https://img.shields.io/travis/yourbuddyconner/pysnap.svg?style=flat\n :target: https://travis-ci.com/yourbuddyconner/pysnap\n.. |pypi| image:: https://img.shields.io/pypi/v/pysnap.svg?style=flat\n :target: https://pypi.python.org/pypi/pysnap\n.. |coveralls| image:: https://coveralls.io/repos/yourbuddyconner/pysnap/badge.svg?branch=master&service=github\n :target: https://coveralls.io/github/yourbuddyconner/pysnap?branch=master\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/yourbuddyconner/pysnap", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pysnap", "package_url": "https://pypi.org/project/pysnap/", "platform": "", "project_url": "https://pypi.org/project/pysnap/", "project_urls": { "Homepage": "https://github.com/yourbuddyconner/pysnap" }, "release_url": "https://pypi.org/project/pysnap/1.0.1/", "requires_dist": [ "six (>=1.10.0)", "termcolor", "nose ; extra == 'nose'", "pytest ; extra == 'pytest'", "six ; extra == 'test'", "pytest (>=3.6.0) ; extra == 'test'", "pytest-cov ; extra == 'test'", "nose ; extra == 'test'", "django (>=1.11.21) ; extra == 'test'" ], "requires_python": "", "summary": "Snapshot Testing utils for Python", "version": "1.0.1" }, "last_serial": 5449252, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "c9f2c8ad2979c8ef3c84e1a1ef694d34", "sha256": "51f87e6e0ce1031a929a903a42406027c207eee7b96fe037a36cbca1e7a8bf5f" }, "downloads": -1, "filename": "pysnap-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c9f2c8ad2979c8ef3c84e1a1ef694d34", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15882, "upload_time": "2019-06-26T01:03:32", "url": "https://files.pythonhosted.org/packages/bb/0f/749a3ca43491c06f72900c788d98fa43bf1c3b1379eccdc02646bc81609a/pysnap-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4abf023470e5cde1f13f9d0b07677b1a", "sha256": "0926f505ecff36594194bfa04226945e2ca980d0337e02e7bb8245c55495896c" }, "downloads": -1, "filename": "pysnap-1.0.tar.gz", "has_sig": false, "md5_digest": "4abf023470e5cde1f13f9d0b07677b1a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11729, "upload_time": "2019-06-26T01:03:35", "url": "https://files.pythonhosted.org/packages/48/a2/21d364751f3cdf4ba12e25368157ca249feefaec9cb955c15aa44f85ff25/pysnap-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "f0923a8d8ab3e035b7e94e8aea2b1313", "sha256": "c2a77b60c980aa898b1e3db51ede199520606fb017e6a0d901faaa3ffbefb752" }, "downloads": -1, "filename": "pysnap-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f0923a8d8ab3e035b7e94e8aea2b1313", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 27226, "upload_time": "2019-06-26T03:03:01", "url": "https://files.pythonhosted.org/packages/fd/86/e4fc59abad1d1d8f108b2f91529e6436c0fa96e29bba6e7d5d0710241afb/pysnap-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ff62b3dc85c63517e9349fabe4bd7872", "sha256": "38be1729221a06a9615afffdd826b27c444a562317a6fb8dd45c7699d841d6f5" }, "downloads": -1, "filename": "pysnap-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ff62b3dc85c63517e9349fabe4bd7872", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13773, "upload_time": "2019-06-26T03:03:02", "url": "https://files.pythonhosted.org/packages/42/2e/5b151baebb1e21fb39fffc72862f307d8cfe37906d4752538f371b281e58/pysnap-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f0923a8d8ab3e035b7e94e8aea2b1313", "sha256": "c2a77b60c980aa898b1e3db51ede199520606fb017e6a0d901faaa3ffbefb752" }, "downloads": -1, "filename": "pysnap-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f0923a8d8ab3e035b7e94e8aea2b1313", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 27226, "upload_time": "2019-06-26T03:03:01", "url": "https://files.pythonhosted.org/packages/fd/86/e4fc59abad1d1d8f108b2f91529e6436c0fa96e29bba6e7d5d0710241afb/pysnap-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ff62b3dc85c63517e9349fabe4bd7872", "sha256": "38be1729221a06a9615afffdd826b27c444a562317a6fb8dd45c7699d841d6f5" }, "downloads": -1, "filename": "pysnap-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ff62b3dc85c63517e9349fabe4bd7872", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13773, "upload_time": "2019-06-26T03:03:02", "url": "https://files.pythonhosted.org/packages/42/2e/5b151baebb1e21fb39fffc72862f307d8cfe37906d4752538f371b281e58/pysnap-1.0.1.tar.gz" } ] }