[Zope-CMF] Re: Tools as local utilities

yuppie y.2006_ at wcm-solutions.de
Wed Nov 22 04:07:31 EST 2006


Hi Jens!


Jens Vagelpohl wrote:
> - - There are failing tests in CMFCore.exportimport.tests.test_actions, 
> basically everything that derives from 
> CMFCore.exportimport.tests.test_actions._ActionSetup. The insidious 
> thing is this:
> 
>   - running all tests or all CMFCore tests shows the failures
> 
>   - running *just* the CMFCore.exportimport tests _passes_
> 
> Right now I don't know if the main problem is about the test harness 
> setup in _ActionSetup, or if there is some strange test interaction/test 
> cleanup issue.

Actually both. The test setup depends on some 'magic' that only works if 
the test is part of the *first* layer run by the testrunner. That's the 
case if you run only the CMFCore.exportimport tests, but not if you run 
all CMFCore tests.

The tests require the site hooks set up correctly, which should be done 
explicitly in the test setup.

This is what happens if you don't do it explicitly:

1.) the layer's setUp() loads Products.Five's meta.zcml
-> this loads the Products.Five.site's meta.zcml
-> this triggers an import of Products.Five.site.fiveconfigure
-> this makes an (unused) import from Products.Five.site.localsite
-> this imports Products.Five.component (for the BBB code)
-> Products.Five.component sets the site hooks

2.) the layer's tearDown() resets the hooks

3.) the next layer can't set up the hooks the same way

This is really nasty, Five should have a more explicit way to set the 
site hooks. Tracking this down did cost me several hours :(


I just checked in a fix for the ExportImportZCMLLayer. If local 
utilities are used in other layers as well, they need the same fix.


Cheers,

	Yuppie



More information about the Zope-CMF mailing list