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.
---------- Forwarded message ----------
From: Thomas Robitaille
Date: Thursday, June 25, 2015
Subject: [Matplotlib-users] ANN: pytest-mpl v0.2
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:
The idea is to make it easy to write a test such as:
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
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:
You can install this plugin with:
pip install pytest-mpl
I would welcome any feedback and/or contributions!
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
Matplotlib-users mailing list