Fix Version/s: None
MemoryTestCase (or a derivative thereof) must be run as the last of all tests in a module in order to properly catch leaks.
This works for py.test, but not when using plain old unittest: the latter does not, so far as I can see, guarantee any sort of ordering as a matter of principle, and, in practice, it sorts things lexicographically (it uses whatever order it gets from running dir() on the test module, and I don't think that's guaranteed to be anything in particular).
For example, consider testAstrometrySourceSelector.py. I made the following change to introduce a memory leak:
Py.test catches it:
But simply running the test suite does not:
Rename the test case:
Based on a very quick check, I think sconsUtils runs tests by simply invoking python, and I'm pretty sure that this is hard-wired into the muscle memory of many developers. In these cases, memory tests written following current guidelines won't be being properly executed.