[Zope3-checkins] Re: [Checkins] SVN: Zope3/trunk/src/zope/app/testing/functional.py Implement ZCMLLayer.tearDown.

Marius Gedminas marius at pov.lt
Wed Jan 24 14:13:31 EST 2007


On Wed, Jan 24, 2007 at 10:27:13AM -0500, Jim Fulton wrote:
> On Jan 20, 2007, at 9:16 AM, Marius Gedminas wrote:
> 
> >Log message for revision 72143:
> >  Implement ZCMLLayer.tearDown.
> 
> This doesn't work.  Unfortunately, there are side effects of ZCML  
> that you aren't undoing.  In particular, for better or worse, ZCML  
> often makes changes to module globals that are not cleaned up by the  
> testing cleanup machinery.

The best solution, IMHO, would be to fix the ZCML directives to install
CleanUp handlers then.

Are these ZCML directives in Zope 3 core, or somewhere else?

> This change caused several test failures in a large application of ours.

Ouch.  Sorry about that.

> Please revert this change.

I would not like that.

How about a compromise: defineLayer() takes an extra argument,
allow_teardown.  It defaults to False, and causes
ZCMLLayer.tearDownLayer to raise NotImplementedError.  All the layers
used in Zope 3 core explicitly pass allow_teardown=True.  3rd party code
is safe.  Later we can make that argument deprecated for a couple of
Zope 3 versions, force 3rd party app developers to fix their cleanup
handlers, then switch the default value to True, then remove it.

On Wed, Jan 24, 2007 at 10:42:14AM -0500, Jim Fulton wrote:
> Gary pointed out to me that there was a real benefit for him in  
> having zope.app.testing.setup.placefulTearDown run.  I suggest an  
> alternate change, which is to have the layer tearDown method call  
> zope.app.testing.setup.placefulTearDown and then raise  
> NotImplementedError.

Can do.

Marius Gedminas
-- 
Un*x admins know what they are doing by definition.
	-- Bernd Petrovitsch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-checkins/attachments/20070124/df4a4eeb/attachment.bin


More information about the Zope3-Checkins mailing list