On 2009-07-13, Marius Gedminas <mar...@gedmin.as> wrote:
> zope.testing supports test layers that muck up the global state
> irrepairably (by letting the layer's tearDown method raise
> NotImplementedError) and continues running the subsequent test layers in
> a fresh and squeaky-clean subprocess.
> Unfortunately, a separate process means separate coverage data tracking,
> and currently zope.testing doesn't support merging coverage data from
> several processes.
> Fortunately, the NotImplementedError in ZCMLLayer's tearDown is just a
> precaution, 99% of the time it is sufficient to run CleanUp.tearDown
> to get the global state restored to its pristine condition.  You can
> indicate that it is safe by passing allow_teardown=3DTrue to ZCMLLayer's
> constructor.  As a result:
>   * the tests will run marginally faster (no subprocess overhead)
>   * you will be able to use pdb in your tests (zope.testing disables pdb
>     in a subprocess since it wants exclusive control over stdout)
>   * you will be able to get accurate coverage tracing.
> Now, how you can convince z3c.testsetup to pass allow_teardown=3DTrue to
> the ZCMLLayer it constructs, I don't know.  I've never used
> z3c.testsetup (although it sounds like an interesting library and I
> should check it out some day).

z3c.testsetup is great as it cuts down on the amount of repeated test setup
code.  (iirc stuff like nose and py.test also try this).

Uli (=z3c.testsetup author), what about changing z3c.testsetup's default in
this regard?


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