nose-devs / nose

nose is nicer testing for python
http://readthedocs.org/docs/nose/en/latest/
1.36k stars 396 forks source link

Free up LazySuite precache while getting tests #1030

Open rtpg opened 7 years ago

rtpg commented 7 years ago

LazySuite will, by default, keep a cache of tests that are being added to it. This cache never gets removed, so when running a very large test suite, older test cases do not get freed, causing memory pressure over the long term.

This patch instead removes elements from the cache as they get read. Since the test are supposed to be iterated over just once, I believe this does not change the outward spec of this class, even if internal details have changed.