astropy/astropy — pull request #450 by mdboom (2012-10-26 19:23:58+00:00)
Title: Adds "unclosed file detection" to the test framework

This replaces the built-in `open` with one that keeps track of open files, and raises an exception if a test has more open files when it finishes than when it began.

This has helped find (in separate commits) some file closing bugs in `io.ascii`, `wcs` and `logger`. There are bunch remaining in `io.fits`, (probably mostly in the test code itself) but I haven't worked through them yet.

This also doesn't work in Python 3 yet.

I thought I'd share this early because it will be useful to verify the craziness that is #425 :)