Closed drewejohnson closed 3 years ago
Tests are failing for python 3.5 because it doesn't look like matplotlib supports saving to files using pathlib.Path
s - https://travis-ci.com/github/CORE-GATECH-GROUP/serpent-tools/jobs/457429722#L1071-L1131
Python 3.5 is already past end-of-life and I've proposed to drop it in #425, probably in the next major release
This commit introduces some machinery that allows us to simply perform plot tests. A new directory
tests/plot
is added with a single test on our BWR spectrum detector, and the expected figure. This is more a test on how our CI system will handle plot comparisons, in particular the tolerances on the image comparisons may bite us.The proposed workflow for adding a plot test is rather simple now. Tests should be added in the plot directory to a file that makes sense, and decorated with the
compare_or_update_plot
decorator. This performs a lot of work behind the scenes to make the test writing easy.matplotlib.testing
tests/plots/result_images/<test_name>.png
and no further actions are takentests/plots/result_images/<test_name>-test.png
and usematplotlib.testing.compare.compare_images
to check the imagesUsing this decorator, the entire BWR spectrum test is four lines, two of which are the decorator and the function signature.
This will be very helpful for improving our coverage, since just running pytest doesn't test plot methods. Our notebooks do, but they don't check for consistency over time, just that a plot can be drawn