Skip to content

Fix tests following test_non_affine_caching, which was leaving a figure behind #943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2012

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Jun 11, 2012

Bug introduced by #723.

@pelson
Copy link
Member

pelson commented Jun 11, 2012

Thanks Mike, so that I know for the future, how does this issue manifest itself? Is it that a figure gets left lying around?

@mdboom
Copy link
Member Author

mdboom commented Jun 11, 2012

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).

@pelson
Copy link
Member

pelson commented Jun 12, 2012

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)

@mdboom
Copy link
Member Author

mdboom commented Jun 12, 2012

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
@mdboom
Copy link
Member Author

mdboom commented Jun 12, 2012

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.

mdboom added a commit that referenced this pull request Jun 12, 2012
Fix tests following test_non_affine_caching, which was leaving a figure behind
@mdboom mdboom merged commit 9bfc97b into matplotlib:master Jun 12, 2012
@mdboom mdboom deleted the transforms-fix-tests branch March 3, 2015 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants