nose-devs / nose

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

utilities for testing leaks #78

Open jpellerin opened 12 years ago

jpellerin commented 12 years ago

Hi,

In another life I have written some simple test methods for testing leaked objects, and survival of objects. You can find the five relevant methods here: http://twistedmatrix.com/trac/browser/branches/libevent-1930-3/twisted/test/test_libevent.py?rev=22266#L219

I was thinking it would be nice if nose provided such utility functions. The one difficulty I see in just re-using the aforementioned methods is that nose does not mandate subclassing a given testcase class, and using global containers would be ugly... Any ideas?

Google Code Info: Issue #: 146 Author: antoine....@gmail.com Created On: 2008-01-06T04:10:41.000Z Closed On:

jpellerin commented 12 years ago

Here is a proposal implementation, with two APIs: an object-oriented API, and a context manager (for use with the new "with" statement). The context manager API is simpler to use but gives the same functionality.

I'm not sure the naming of the API is perfect.

Unit tests are included.

Google Code Info: Author: antoine....@gmail.com Created On: 2008-01-06T21:51:44.000Z

jpellerin commented 12 years ago

Google Code Info: Author: j...@pobox.com Created On: 2008-03-24T14:41:20.000Z