{ "info": { "author": "Thomas Robitaille", "author_email": "thomas.robitaille@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Pytest", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Visualization", "Topic :: Software Development :: Testing" ], "description": "|Travis Build Status| |AppVeyor Build status| |Coveralls coverage|\n\nAbout\n-----\n\nThis is a plugin to facilitate image comparison for\n`Matplotlib `__ figures in pytest.\n\nMatplotlib includes a number of test utilities and decorators, but these\nare geared towards the `nose `__ testing\nframework. Pytest-mpl makes it easy to compare figures produced by tests\nto reference images when using `pytest `__.\n\nFor each figure to test, the reference image is subtracted from the\ngenerated image, and the RMS of the residual is compared to a\nuser-specified tolerance. If the residual is too large, the test will\nfail (this is implemented using helper functions from\n``matplotlib.testing``).\n\nFor more information on how to write tests to do this, see the **Using**\nsection below.\n\nInstalling\n----------\n\nThis plugin is compatible with Python 2.6, 2.7, and 3.3 and later, and\nrequires `pytest `__,\n`matplotlib `__ and\n`nose `__ to be installed (nose is\nrequired by Matplotlib).\n\nTo install, you can do:\n\n::\n\n pip install pytest-mpl\n\nYou can check that the plugin is registered with pytest by doing:\n\n::\n\n py.test --version\n\nwhich will show a list of plugins:\n\n::\n\n This is pytest version 2.7.1, imported from ...\n setuptools registered plugins:\n pytest-mpl-0.1 at ...\n\nUsing\n-----\n\nTo use, you simply need to mark the function where you want to compare\nimages using ``@pytest.mark.mpl_image_compare``, and make sure that the\nfunction returns a Matplotlib figure (or any figure object that has a\n``savefig`` method):\n\n.. code:: python\n\n import pytest\n import matplotlib.pyplot as plt\n\n @pytest.mark.mpl_image_compare\n def test_succeeds():\n fig = plt.figure()\n ax = fig.add_subplot(1,1,1)\n ax.plot([1,2,3])\n return fig\n\nTo generate the baseline images, run the tests with the\n``--mpl-generate-path`` option with the name of the directory where the\ngenerated images should be placed:\n\n::\n\n py.test --mpl-generate-path=baseline\n\nIf the directory does not exist, it will be created. The directory will\nbe interpreted as being relative to where you are running ``py.test``.\nOnce you are happy with the generated images, you should move them to a\nsub-directory called ``baseline`` relative to the test files (this name\nis configurable, see below). You can also generate the baseline images\ndirectly in the right directory.\n\nYou can then run the tests simply with:\n\n::\n\n py.test --mpl\n\nand the tests will pass if the images are the same. If you omit the\n``--mpl`` option, the tests will run but will only check that the code\nruns without checking the output images.\n\nOptions\n-------\n\nTolerance\n^^^^^^^^^\n\nThe RMS tolerance for the image comparison (which defaults to 2) can be\nspecified in the ``mpl_image_compare`` decorator with the ``tolerance``\nargument:\n\n.. code:: python\n\n @pytest.mark.mpl_image_compare(tolerance=20)\n def test_image():\n ...\n\nSavefig options\n^^^^^^^^^^^^^^^\n\nYou can pass keyword arguments to ``savefig`` by using\n``savefig_kwargs`` in the ``mpl_image_compare`` decorator:\n\n.. code:: python\n\n @pytest.mark.mpl_image_compare(savefig_kwargs={'dpi':300})\n def test_image():\n ...\n\nBaseline images\n^^^^^^^^^^^^^^^\n\nThe baseline directory (which defaults to ``baseline`` ) and the\nfilename of the plot (which defaults to the name of the test with a\n``.png`` suffix) can be customized with the ``baseline_dir`` and\n``filename`` arguments in the ``mpl_image_compare`` decorator:\n\n.. code:: python\n\n @pytest.mark.mpl_image_compare(baseline_dir='baseline_images',\n filename='other_name.png')\n def test_image():\n ...\n\nThe baseline directory in the decorator above will be interpreted as\nbeing relative to the test file. Note that the baseline directory can\nalso be a URL (which should start with ``http://`` or ``https://`` and\nend in a slash). If you want to specify mirrors, set ``baseline_dir`` to\na comma-separated list of URLs (real commas in the URL should be encoded\nas ``%2C``).\n\nFinally, you can also set a custom baseline directory globally when\nrunning tests by running ``py.test`` with:\n\n::\n\n py.test --mpl --mpl-baseline-path=baseline_images\n\nThis directory will be interpreted as being relative to where the tests\nare run. In addition, if both this option and the ``baseline_dir``\noption in the ``mpl_image_compare`` decorator are used, the one in the\ndecorator takes precedence.\n\nBase style\n^^^^^^^^^^\n\nBy default, tests will be run using the Matplotlib 'classic' style\n(ignoring any locally defined RC parameters). This can be overriden by\nusing the ``style`` argument:\n\n.. code:: python\n\n @pytest.mark.mpl_image_compare(style='fivethirtyeight')\n def test_image():\n ...\n\nRemoving text\n^^^^^^^^^^^^^\n\nIf you are running a test for which you are not interested in comparing\nthe text labels, you can use the ``remove_text`` argument to the\ndecorator:\n\n.. code:: python\n\n @pytest.mark.mpl_image_compare(remove_text=True)\n def test_image():\n ...\n\nThis will make the test insensitive to changes in e.g. the freetype\nlibrary.\n\nTest failure example\n--------------------\n\nIf the images produced by the tests are correct, then the test will\npass, but if they are not, the test will fail with a message similar to\nthe following:\n\n::\n\n E Exception: Error: Image files did not match.\n E RMS Value: 142.2287807767823\n E Expected:\n E /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmp4h4oxr7y/baseline-coords_overlay_auto_coord_meta.png\n E Actual:\n E /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmp4h4oxr7y/coords_overlay_auto_coord_meta.png\n E Difference:\n E /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmp4h4oxr7y/coords_overlay_auto_coord_meta-failed-diff.png\n E Tolerance:\n E 10\n\nThe image paths included in the exception are then available for\ninspection:\n\n+----------------+----------------+-------------+\n| Expected | Actual | Difference |\n+================+================+=============+\n| |expected| | |actual| | |diff| |\n+----------------+----------------+-------------+\n\nIn this case, the differences are very clear, while in some cases it may\nbe necessary to use the difference image, or blink the expected and\nactual images, in order to see what changed.\n\nThe default tolerance is 2, which is very strict. In some cases, you may\nwant to relax this to account for differences in fonts across different\nsystems.\n\nBy default, the expected, actual and difference files are written to a\ntemporary directory with a non-deterministic path. If you want to instead\nwrite them to a specific directory, you can use::\n\n py.test --mpl --mpl-results-path=results\n\nThe ``results`` directory will then contain one sub-directory per test, and each\nsub-directory will contain the three files mentioned above. If you are using a\ncontinuous integration service, you can then use the option to upload artifacts\nto upload these results to somewhere where you can view them. For more\ninformation, see:\n\n* `Uploading artifacts on Travis-CI `_\n* `Build Artifacts (CircleCI) `_\n* `Packaging Artifacts (AppVeyor) `_\n\nRunning the tests for pytest-mpl\n--------------------------------\n\nIf you are contributing some changes and want to run the tests, first\ninstall the latest version of the plugin then do:\n\n::\n\n cd tests\n py.test --mpl\n\nThe reason for having to install the plugin first is to ensure that the\nplugin is correctly loaded as part of the test suite.\n\n.. |Travis Build Status| image:: https://travis-ci.org/matplotlib/pytest-mpl.svg?branch=master\n :target: https://travis-ci.org/matplotlib/pytest-mpl\n.. |AppVeyor Build status| image:: https://ci.appveyor.com/api/projects/status/mf7hs44scg5mvcyo?svg=true\n :target: https://ci.appveyor.com/project/astrofrog/pytest-mpl\n.. |Coveralls coverage| image:: https://coveralls.io/repos/matplotlib/pytest-mpl/badge.svg\n :target: https://coveralls.io/r/matplotlib/pytest-mpl\n.. |expected| image:: images/baseline-coords_overlay_auto_coord_meta.png\n.. |actual| image:: images/coords_overlay_auto_coord_meta.png\n.. |diff| image:: images/coords_overlay_auto_coord_meta-failed-diff.png\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/matplotlib/pytest-mpl", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "pytest-mpl", "package_url": "https://pypi.org/project/pytest-mpl/", "platform": "", "project_url": "https://pypi.org/project/pytest-mpl/", "project_urls": { "Homepage": "https://github.com/matplotlib/pytest-mpl" }, "release_url": "https://pypi.org/project/pytest-mpl/0.10/", "requires_dist": [ "pytest", "matplotlib", "nose" ], "requires_python": "", "summary": "pytest plugin to help with testing figures output from Matplotlib", "version": "0.10" }, "last_serial": 4308196, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "47fe261117f30a7b53c5054c587951db", "sha256": "0fb4284ba114aa98b4d0ab38b9f000ebbdc6d47ad281d9cc898325623e27e2b4" }, "downloads": -1, "filename": "pytest-mpl-0.1.tar.gz", "has_sig": false, "md5_digest": "47fe261117f30a7b53c5054c587951db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23156, "upload_time": "2015-06-25T20:26:53", "url": "https://files.pythonhosted.org/packages/8c/77/3a65a9d5115b551ecaca2365c29406e1104f1147dfa4345501bc3f0f747b/pytest-mpl-0.1.tar.gz" } ], "0.1.dev0": [], "0.10": [ { "comment_text": "", "digests": { "md5": "81a00611052f0f99a6fbb511cee5310d", "sha256": "821d6ec4356046037e72f35584f3a2187b247eec80493107d36ae9d8f201fce6" }, "downloads": -1, "filename": "pytest_mpl-0.10-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "81a00611052f0f99a6fbb511cee5310d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 21544, "upload_time": "2018-09-25T11:26:46", "url": "https://files.pythonhosted.org/packages/b8/df/7780fe5ddcf734254eb0c528c984c6fda020d53cb166cb7d96a83a1f0636/pytest_mpl-0.10-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eaf812561972f3aa3d4e1f1c077ba848", "sha256": "7006e63bf1ca9c50bea3d189c0f862751a16ce40bb373197b218f57af5b837c0" }, "downloads": -1, "filename": "pytest-mpl-0.10.tar.gz", "has_sig": false, "md5_digest": "eaf812561972f3aa3d4e1f1c077ba848", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 195996, "upload_time": "2018-09-25T11:26:50", "url": "https://files.pythonhosted.org/packages/a6/c6/fa6c04e1b0cdb209f58eb9a8f85913cac48a43433204246861eeea59704f/pytest-mpl-0.10.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "91b47594768b3dea447138772b7435a1", "sha256": "d9eecac1a8c159375486ff38d0317a8744892f11142e8b6a48d4583e32046b1f" }, "downloads": -1, "filename": "pytest-mpl-0.2.tar.gz", "has_sig": false, "md5_digest": "91b47594768b3dea447138772b7435a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23975, "upload_time": "2015-06-25T23:33:31", "url": "https://files.pythonhosted.org/packages/fa/17/0b5c55bdee734a525d214430a24bcc469399482c7d8be0343b0e9ee530dc/pytest-mpl-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "45912acdd8ae63358711de431ac076ec", "sha256": "d6f19e637ccf0a71bd129adf51f8aedd8de1a742d14cc4e3e9ae3154ed7ff69e" }, "downloads": -1, "filename": "pytest-mpl-0.3.tar.gz", "has_sig": false, "md5_digest": "45912acdd8ae63358711de431ac076ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 82744, "upload_time": "2015-06-26T12:07:41", "url": "https://files.pythonhosted.org/packages/1a/44/93ef01957c5ddd1324577401355c1d7b4240a679df8ed8a493a1630878d3/pytest-mpl-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "27e59d2583812112c62664e6a29b38ed", "sha256": "275aea07a73ceb6e6270e7e6f54dfd67c9c9f002d090016619d7d34b284c6ef6" }, "downloads": -1, "filename": "pytest-mpl-0.4.tar.gz", "has_sig": false, "md5_digest": "27e59d2583812112c62664e6a29b38ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 112468, "upload_time": "2016-05-04T15:16:37", "url": "https://files.pythonhosted.org/packages/85/c2/1beb15593897507762a01704b86bedb301180eee96f5be92cee7ff1dfc14/pytest-mpl-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "760d6304b933dd21cf576366caccfae3", "sha256": "fee0da4a81e2a3e966cf6488a6bcc81a144688e145048ad1f66799a25135dad3" }, "downloads": -1, "filename": "pytest-mpl-0.5.tar.gz", "has_sig": false, "md5_digest": "760d6304b933dd21cf576366caccfae3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 112523, "upload_time": "2016-05-06T09:48:17", "url": "https://files.pythonhosted.org/packages/cb/db/a7b8c2bb859b4f021e349adbebe6968036dd6f236a98be795c1fe621d340/pytest-mpl-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "e00c06dee7fa0d70de833d4e5396e3c3", "sha256": "f8d118bef697ba88ae3ecad91a13c40497893caa4dcd0438bc964e5fb8f67c77" }, "downloads": -1, "filename": "pytest-mpl-0.6.tar.gz", "has_sig": false, "md5_digest": "e00c06dee7fa0d70de833d4e5396e3c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 235501, "upload_time": "2016-11-22T17:14:50", "url": "https://files.pythonhosted.org/packages/41/15/203f0992cd01451c442e5b04537486e79e804bc8b9e3efb754dc884d7a37/pytest-mpl-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "9c9bc0f4b48c14497600fde10db07336", "sha256": "cc975b5b905826bd1a04f780ca4a3309b309e5f5eb7824c2cf9252ee878668b7" }, "downloads": -1, "filename": "pytest-mpl-0.7.tar.gz", "has_sig": false, "md5_digest": "9c9bc0f4b48c14497600fde10db07336", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 243763, "upload_time": "2016-11-26T11:04:37", "url": "https://files.pythonhosted.org/packages/39/72/980fe1c5d276b28d97bcf172e947a11743a2a12b484dbe3c0f0e90e3bc95/pytest-mpl-0.7.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "fe07965e861922e88a2642767865af4f", "sha256": "e3b22199522d9c195a10fe251ca098c2b856b01ee4af5118c85b117d5b1c05b4" }, "downloads": -1, "filename": "pytest_mpl-0.8-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fe07965e861922e88a2642767865af4f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 19574, "upload_time": "2017-07-19T11:58:58", "url": "https://files.pythonhosted.org/packages/c0/db/988a8c4171c0f528fc2814a5c16a01f6c7ff940a90cfb4dcc0d4cbecf356/pytest_mpl-0.8-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f717331bec4fcc8da43dc81fce44ff12", "sha256": "d8c67a781cfd011fd9f20cb5a957f62701afcc5b44685c98369e1c22df960ccd" }, "downloads": -1, "filename": "pytest-mpl-0.8.tar.gz", "has_sig": false, "md5_digest": "f717331bec4fcc8da43dc81fce44ff12", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 194633, "upload_time": "2017-07-19T11:59:00", "url": "https://files.pythonhosted.org/packages/17/6a/08864a8d48b5d511a6c15074f73abc6f2855e9714c5aefd7c9f90953ee62/pytest-mpl-0.8.tar.gz" } ], "0.9": [ { "comment_text": "", "digests": { "md5": "55efd4ed1bb08ae3f933232996fd73eb", "sha256": "4bad87089e28ad3d800454fa19402ca8d3f188a45af4a1da2a224da49d814b0b" }, "downloads": -1, "filename": "pytest_mpl-0.9-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "55efd4ed1bb08ae3f933232996fd73eb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20315, "upload_time": "2017-10-12T21:01:03", "url": "https://files.pythonhosted.org/packages/07/4f/36ce8c98442b775fa3793a5d51ceca768c3a4281fcedb22d98e5227a95e5/pytest_mpl-0.9-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c13853b85dbe5c50ba9b7e8f9dc96439", "sha256": "8f49dffb39e232c081961a5fc914c45703d17579a627b694a70b91d7670200bc" }, "downloads": -1, "filename": "pytest-mpl-0.9.tar.gz", "has_sig": false, "md5_digest": "c13853b85dbe5c50ba9b7e8f9dc96439", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 195584, "upload_time": "2017-10-12T21:01:07", "url": "https://files.pythonhosted.org/packages/00/96/1ecb3f09023fb01609505fda0dc53df7cb64786286279710b9a2895232ee/pytest-mpl-0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "81a00611052f0f99a6fbb511cee5310d", "sha256": "821d6ec4356046037e72f35584f3a2187b247eec80493107d36ae9d8f201fce6" }, "downloads": -1, "filename": "pytest_mpl-0.10-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "81a00611052f0f99a6fbb511cee5310d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 21544, "upload_time": "2018-09-25T11:26:46", "url": "https://files.pythonhosted.org/packages/b8/df/7780fe5ddcf734254eb0c528c984c6fda020d53cb166cb7d96a83a1f0636/pytest_mpl-0.10-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eaf812561972f3aa3d4e1f1c077ba848", "sha256": "7006e63bf1ca9c50bea3d189c0f862751a16ce40bb373197b218f57af5b837c0" }, "downloads": -1, "filename": "pytest-mpl-0.10.tar.gz", "has_sig": false, "md5_digest": "eaf812561972f3aa3d4e1f1c077ba848", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 195996, "upload_time": "2018-09-25T11:26:50", "url": "https://files.pythonhosted.org/packages/a6/c6/fa6c04e1b0cdb209f58eb9a8f85913cac48a43433204246861eeea59704f/pytest-mpl-0.10.tar.gz" } ] }