[Grok-dev] Re: How to hook up custom layers with z3c.testsetup?

Uli Fouquet uli at gnufix.de
Fri Jun 20 12:15:51 EDT 2008

Hi there,

Philipp von Weitershausen wrote:

> I was just helping out Ivo on IRC setting up some integration tests for 
> his Grok application and I wondered how you hook up doctests to use a 
> custom ZCML-based integration layer with the new z3c.testsetup-based 
> test_suite...
> Uli, any pointers?

The layer setup might currently not be as sophisticated as it would be
desirable :-(

When setting up a layer (only one is supported currently), you can use
the following parameters:

- `zcml_config`: filesystem path to a ZCML config

  Default: any `ftesting.zcml` in the package, that is registered.


      import os
      import z3c.testsetup
      import my.package
      test_suite = z3c.testsetup.register_all_tests(
          zcml_config = os.path.join(
              os.path.dirname(my.package.__file__), 'myftesting.zcml'))

    will look for a file 'myftesting.zcml' in ``my.package``.

- `layer_name`: string

  Registers the layer under the given name.

- `layer`: ZCML layer object

  This overrides any of the above options. This way you can define your 
  own layer like this::

     from zope.app.testing.functional import ZCMLLayer
     mylayer = ZCMLLayer(
          os.path.join(os.path.dirname(__file__), 'ftesting.zcml'),

   and call `register_all_tests` afterwards like this::

      test_suite = z3c.testsetup.register_all_tests(
          'my.package', layer = mylayer)

More details about this can be found here:


I assume, you were aware of that possibilities, so there might be
something missing. If so, please tell. I am very open for proposals, how
we can improve the usability of the package :-)

Hope that helps at least a bit.

Kind regards,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20080620/570aff42/attachment-0001.bin

More information about the Grok-dev mailing list