Hi everyone,

I have just released a small plugin for py.test that wraps the image
comparison functionality in matplotlib.testing, for use in other
packages that use py.test as the testing framework instead of nose:

  https://github.com/astrofrog/pytest-mpl

The idea is to make it easy to write a test such as:

    @pytest.mark.mpl_image_compare
    def test_succeeds():
        fig = plt.figure()
        ax = fig.add_subplot(1,1,1)
        ax.plot([1,2,3])
        return fig

which can then be run in three ways:

- Running py.test as usual will simply check the tests run but won't
check whether the figure is correct.

- Running py.test with the --mpl option will make sure that the figure
produced by the test is the same as a reference image

- Running py.test with the --mpl-generate-path option will generate the
reference images from the tests themselves.

There are a number of other options, including ways to pass arguments to
savefig, customizing the image names, or setting the tolerance for the
comparison. All the documentation is contained in the README.md file:

  https://github.com/astrofrog/pytest-mpl/blob/master/README.md

You can install this plugin with:

  pip install pytest-mpl

I would welcome any feedback and/or contributions!

Cheers,
Tom

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to