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.<div><br></div><div>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, <span></span>while I start my new position, feel free to try.</div><div><br></div><div>Nathan<br><br>---------- Forwarded message ----------<br>From: <b>Thomas Robitaille</b> <<a href="mailto:thomas.robitaille@gmail.com">thomas.robitaille@gmail.com</a>><br>Date: Thursday, June 25, 2015<br>Subject: [Matplotlib-users] ANN: pytest-mpl v0.2<br>To: <a href="mailto:matplotlib-users@lists.sourceforge.net">matplotlib-users@lists.sourceforge.net</a><br><br><br>Hi everyone,<br>
<br>
I have just released a small plugin for py.test that wraps the image<br>
comparison functionality in matplotlib.testing, for use in other<br>
packages that use py.test as the testing framework instead of nose:<br>
<br>
  <a href="https://github.com/astrofrog/pytest-mpl" target="_blank">https://github.com/astrofrog/pytest-mpl</a><br>
<br>
The idea is to make it easy to write a test such as:<br>
<br>
    @pytest.mark.mpl_image_compare<br>
    def test_succeeds():<br>
        fig = plt.figure()<br>
        ax = fig.add_subplot(1,1,1)<br>
        ax.plot([1,2,3])<br>
        return fig<br>
<br>
which can then be run in three ways:<br>
<br>
- Running py.test as usual will simply check the tests run but won't<br>
check whether the figure is correct.<br>
<br>
- Running py.test with the --mpl option will make sure that the figure<br>
produced by the test is the same as a reference image<br>
<br>
- Running py.test with the --mpl-generate-path option will generate the<br>
reference images from the tests themselves.<br>
<br>
There are a number of other options, including ways to pass arguments to<br>
savefig, customizing the image names, or setting the tolerance for the<br>
comparison. All the documentation is contained in the README.md file:<br>
<br>
  <a href="https://github.com/astrofrog/pytest-mpl/blob/master/README.md" target="_blank">https://github.com/astrofrog/pytest-mpl/blob/master/README.md</a><br>
<br>
You can install this plugin with:<br>
<br>
  pip install pytest-mpl<br>
<br>
I would welcome any feedback and/or contributions!<br>
<br>
Cheers,<br>
Tom<br>
<br>
------------------------------------------------------------------------------<br>
Monitor 25 network devices or servers for free with OpManager!<br>
OpManager is web-based network management software that monitors<br>
network devices and physical & virtual servers, alerts via email & sms<br>
for fault. Monitor 25 devices for free with no restriction. Download now<br>
<a href="http://ad.doubleclick.net/ddm/clk/292181274;119417398;o" target="_blank">http://ad.doubleclick.net/ddm/clk/292181274;119417398;o</a><br>
_______________________________________________<br>
Matplotlib-users mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'Matplotlib-users@lists.sourceforge.net')">Matplotlib-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/matplotlib-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/matplotlib-users</a><br>
<br></div>