Re: [Pyunit-interest] Feature Request: Cleanup Registry
Brought to you by:
purcell
From: Jim F. <ji...@zo...> - 2002-08-02 20:25:34
|
Steve Purcell wrote: > Hi Jim, > > Sorry for the slow response. > > Interesting suggestion. I wonder about a couple of things. > > Firstly, not every test would require every cleanup function to be > called, so calling every function after every test seems a high > price to pay for convenience. Imagine running 10,000 tests, > where each block of 100 requires a single (but different) clean-up > function: that's 1,000,000 cleanup function invocations instead > of 10,000. Good point. > Secondly, I'm nervous about the notion of adding clean-up functions > to the clean-up registry from 'outside' testing code, as in the > example you provided. What if the test module is imported multiple > times, e.g. by the unittest GUI? Typically, the registrations would be done by application modules, not test modules. Would the unittest GUI reload application modules? That sounds like a recipe for disaster. ... > Cleaning-up of component registries is to be done after every > Zope test, as I understand things. In that case, I'd think > a common base class for your Zope test cases is in order, with a > standardised 'tearDown()' that all subclasses should call if they > also implement a 'tearDown()' method. This is a safer solution, in > my opinion. That is the solution I'm using now. You are right, in that tests that are *known* not to produce side-effects can avoid the extra clean up work. > Or am I missing something? Nope. I like your scalability argument. Thanks. BTW, neither of your responses seem to have shown up in the source forge mail archive. Jim -- Jim Fulton mailto:ji...@zo... Python Powered! CTO (888) 344-4332 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org |