[Zope-CMF] Re: Tools as local utilities

yuppie y.2007- at wcm-solutions.de
Fri Feb 2 14:32:57 EST 2007


Hi Jens!


Jens Vagelpohl wrote:
> 
> On 24 Jan 2007, at 12:58, yuppie wrote:
>> The logging messages no longer show up and I simplified the 
>> FunctionalLayer tests. No need to register the tools again - 
>> setSite(self.app.site) sets up the correct registry.
>>
>> But the cleanup issues are still not resolved. AFAICS the problem is 
>> caused by the new registerUtility() calls that pollute the global 
>> registry.
>>
>> Inside layers we can't use cleanUp() because it would destroy the 
>> layer setup. I'm afraid each test needs an explicit 
>> unregisterUtility() for each registered tool.
>>
>> Or maybe we should perform a complete set up / tear down for each unit 
>> test, not just for the layer. This way we can always use cleanUp(). 
>> That might not be too expensive for non-functional tests.
>>
>> Functional tests don't have the same problem because there is no need 
>> to mess around with the global registry.
> 
> I'm going to spend some time this weekend adding unregisterUtility where 
> needed. Thanks for your help!

That's no longer necessary. I changed the set up / tear down for 
non-functional layers. The layers now call cleanUp() after each test.

Maybe there are still some non-layer tests that should have a cleanUp(), 
but at least with the order tests are run in my sandbox all cleanup 
issues are resolved.


Cheers,

	Yuppie



More information about the Zope-CMF mailing list