[Zope-CMF] Test setup problems with Zope 2.13
Hanno Schlichting
hanno at hannosch.eu
Mon Jul 19 14:53:27 EDT 2010
Hi.
Looks like nobody feels like jumping into the test layers waters.
Unless someone does in the next days, I'll revert the OFS / OFSP
refactoring on Zope trunk.
Hanno
On Sun, Jul 11, 2010 at 1:54 PM, Hanno Schlichting <hanno at hannosch.eu> wrote:
> Maybe you have noticed from my commits today, but we have some test
> setup problems in Zope 2.13. I tried to solve those, but failed so
> far. Unfortunately we don't have nightly test runs for any CMF + Zope
> 2.13 combination for a while, so I'm not sure when all the problems
> started.
>
> One recent problem is due to my refactoring of Products.OFSP / OFS
> though. I moved the registrations of all standard OFS types from the
> initialize of OFSP into an initialize in OFS itself. In order for this
> to be picked up, I added the five:registerPackage statement, including
> a hint at the initialize function to OFS' configure.zcml.
>
> During normal Zope startup this works fine and the initialize is
> called. But we have a problem with ZopeTestCase based tests. So far it
> did an installProduct('OFSP') call unconditionally at module scope. As
> soon as someone imported it, the OFS types got registered. If the
> ZopeLite layer was active, the call was deferred to its layer setup
> time.
>
> In Zope 2.13 I removed the installProduct('OFSP') call, as it doesn't
> do anything anymore (apart from registering help system stuff which
> nobody needs in tests). But I cannot simply put an
> installPackage('OFS') in there as a replacement. In order for that to
> work, one needs to load the OFS.configure.zcml first (the
> five:registerPackage to be exact). Since ZopeTestCase doesn't know
> anything about ZCML setup so far, I don't want to introduce any such
> handling. Consumers of ZopeTestCase have all dealt with ZCML loading
> in various different ways and I expect even bigger problems when
> changing anything there.
>
> But this means any testcase that needs the OFS types (to show up in
> all_meta_types for example) will need to set up the ZCML and call
> installPackage itself. I tried to do this in CMFCore by adding a new
> layer, but cannot get it to work. There's always some side-effects in
> other tests. It doesn't help that installPackage internally does a
> transaction.commit() in 2.12 but not in 2.13.
>
> If anyone more familiar with the multitude of CMF test layers could
> help, that would be much appreciated.
More information about the Zope-CMF
mailing list