On 2009-07-13, Marius Gedminas <mar...@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 van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Software developer at http://www.thehealthagency.com
"Military engineers build missiles. Civil engineers build targets"

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to