This is interesting. We do something similar in our current test setup, but it's nice to see this sort of thing become part of a testing library.

Looking into moving from nose to py.test should definitely be on our radar given the migration of the Python community in that direction over the past year or two. py.test has some interesting features (like test fixtures) that might make it easier for us to write tests going forward. That said, the answer testing framework is quite complicated, and it might take some effort to port that. I hope to look at this myself in the coming months, but if anyone wants to take up the slack in looking at the feasibility of us in py.test, while I start my new position, feel free to try.

Nathan

---------- Forwarded message ----------
From: Thomas Robitaille <thomas.robitaille@gmail.com>
Date: Thursday, June 25, 2015
Subject: [Matplotlib-users] ANN: pytest-mpl v0.2
To: matplotlib-users@lists.sourceforge.net


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