proplot-dev / proplot

🎨 A succinct matplotlib wrapper for making beautiful, publication-quality graphics
https://proplot.readthedocs.io
MIT License
1.07k stars 96 forks source link

Add pytest-mpl image comparison tests and update CI workflow #413

Open lukelbd opened 1 year ago

lukelbd commented 1 year ago

This will finally add robust image comparison testing to proplot using matplotlib/pytest-mpl.

Inside tests, I declare several functions developed from my own ad hoc jupyter notebook tests. These will be automatically detected + run by pytest, with image comparisons carried out by pytest-mpl. Further, inside tests/test_docs.py, I dynamically create testing functions from the rst-style python files in docs using jupytext, so that pytest-mpl can perform image comparisons on the documentation examples alongside the other testing files. So, the travis CI no longer compiles the documentation with make html -- instead, the existing readthedocs workflow does this, and it should also now be enabled for new pull requests (if not, will try to figure out soon). I also use a fork of pytest-mpl to support comparing arbitrary figures created by each testing function (i.e., without explicitly returning figure objects; see this branch).

This work was done quite a while ago -- has just been sitting on my machine. Would like to merge it this spring.