Hi Chris!

Chris Withers wrote:
yuppie wrote:

ZCML is set up using test layers. Their setUp() and tearDown() methods are only run once for all tests in the layer.

Maybe of interest, I've attached the layers file I use when testing Zope 2 apps. It "does the right thing" w.r.t. having a DemoStorage for each layer, letting you safely commit transactions containing layer setup and then using the using transaction.begin()/transaction.abort() dance in the tests themselves.

Is this code useful? Should I look to check it in to the core anywhere?

1.) I doubt the transaction.begin()/transaction.abort() dance makes still sense if you use DemoStorage.

2.) Whit did some test layer work on this branch:
Maybe you can join forces with him? It would be great if test layers could be used instead of the ZopeTestCase test cases.

For functional tests that depend on a complete CMF site, you can use the FunctionalLayers defined in the testing modules. They have to be used with ZopeTestCase's FunctionalTestCase

Hmmm, which version of Zope did this arrive in?

Don't know, I use the sandboxed test cases only with Zope 2.10.0. But AFAICS the same pattern should work with Zope 2.9.5 as well.

Finally, a question of my own, how do you use layers with doctests?




Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to