[Zope-dev] test setup layer sorting

Reinout van Rees reinout at vanrees.org
Mon Jul 13 08:27:50 EDT 2009


On 2009-07-13, Marius Gedminas <marius at gedmin.as> wrote:
>
> Whatever grok does that interferes with coverage should be fixed.

I did some more debugging.  In the end it boils down to this:

With z3c.testsetup, you can specify a zcml file at the top of your test file.
z3c.testsetup creates a ZCMLLayer with that zcml file.

I my test files, I had two separate zcml files (one registered a bit more than
the other).  So I ended up with two separate ZCMLLayer subclasses.  And both
did some grokking.  So apparently the teardown of a ZCMLLayer subclass when
going from one to the next isn't that clean.  There *is* a warning in
zope.testing that teardown isn't fully supported.

Personally, I'm not sure where the exact problem is.  Grok does decorator-like
wrapping (should not throw off the coverage testing) and plain component
architecture registration (should not throw off the coverage testing either).
Tearing down a component architecture layer?  Code coverage problems don't
seem too common.  Probably an interaction between two problems.


How I solved it: just use one zcml layer in z3c.testsetup and do some extra
grokking in the test itself instead of in the second zcml file.



Reinout


-- 
Reinout van Rees - reinout at vanrees.org - http://reinout.vanrees.org
Software developer at http://www.thehealthagency.com
"Military engineers build missiles. Civil engineers build targets"



More information about the Zope-Dev mailing list