Fix tests following test_non_affine_caching, which was leaving a figure behind#943
Conversation
|
Thanks Mike, so that I know for the future, how does this issue manifest itself? Is it that a figure gets left lying around? |
|
The image comparison tests create any number of figures, and then the testing framework iterates through all active figures and compares them to baseline images. This means that any tests that keep figures open will cause subsequent image comparison tests to fail. We have a decorator "@cleanup" which conveniently clears all figures after a test is run (among other memory-related cleanups). It's a little cumbersome to have to remember this, but it seems that nose does not allow for a "global" teardown method (at least last time I looked about a year and a half ago). |
|
I wouldn't know where to go to find this information out. Is is documented anywhere? If not, would you mind adding some? (it doesn't have to be done in this ticket, which has my +1) |
|
Yeah -- that's not very well documented. It is documented that figures created through pyplot are persistent and need to be forcibly cleared, but it should be added that this is of particular concern in test functions since that can have side effects on other tests. I will add a blurb to the testing documentation about this (and the cleanup decorator) in a future pull request. |
1 similar comment
|
Yeah -- that's not very well documented. It is documented that figures created through pyplot are persistent and need to be forcibly cleared, but it should be added that this is of particular concern in test functions since that can have side effects on other tests. I will add a blurb to the testing documentation about this (and the cleanup decorator) in a future pull request. |
Fix tests following test_non_affine_caching, which was leaving a figure behind
Bug introduced by #723.