Index: /main/waeup.sirp/trunk/src/waeup/sirp/testing.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/testing.py	(revision 5795)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/testing.py	(revision 5796)
@@ -2,4 +2,5 @@
 """
 import os.path
+import warnings
 import grok
 import zope.component
@@ -7,4 +8,5 @@
 from zope.app.testing.functional import ZCMLLayer
 from zope.component import getGlobalSiteManager
+from zope.testing.cleanup import cleanUp
 
 ftesting_zcml = os.path.join(
@@ -12,17 +14,4 @@
 FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer',
                             allow_teardown=True)
-
-class WAeUPSIRPUnitTestLayer(object):
-    """A layer for doctests that groks `waeup.sirp`.
-    """
-    @classmethod
-    def setUp(self):
-        import grok
-        grok.testing.grok('waeup.sirp')
-
-    @classmethod
-    def tearDown(self):
-        pass
-
 
 def setUpZope(test=None):
@@ -57,10 +46,15 @@
     Returns ``True`` if grokking was done, ``False`` else.
 
+    .. The following samples should go into Sphinx docs directly....
+    
     Sample
     ******
+
+    Usage with plain Python testrunners
+    -----------------------------------
     
     Together with the :func:`setUpZope` and :func:`cleanUpZope`
     functions we then can do unittests with all components registered
-    like this::
+    and the event dispatcher in place like this::
 
       import unittest2 as unittest # Want Python 2.7 features
@@ -101,4 +95,20 @@
     won't work out of the box. The benefit is the faster test
     setup/teardown.
+
+    .. note:: This works only with the default Python testrunners.
+    
+         If you use the Zope testrunner (from :mod:`zope.testing`)
+         then you have to use appropriate layers like the
+         :class:`waeup.sirp.testing.WAeUPSIRPUnitTestLayer`.
+
+    Usage with :mod:`zope.testing` testrunners
+    ------------------------------------------
+
+    If you use the standard Zope testrunner, classmethods like
+    `setUpClass` are not executed. Instead you have to use a layer
+    like the one defined in this module.
+
+    .. seealso:: :class:`waeup.sirp.testing.WAeUPSIRPUnitTestLayer`
+    
     """
     gsm =  getGlobalSiteManager()
@@ -112,2 +122,49 @@
     warnings.simplefilter('default') # reenable warnings
     return True
+
+
+class WAeUPSIRPUnitTestLayer(object):
+    """A layer for tests that groks `waeup.sirp`.
+
+    A Zope test layer that registers all :mod:`waeup.sirp` components
+    before attached tests are run and cleans this registrations up
+    afterwards. Also basic (non-waeup.sirp) components like the event
+    dispatcher machinery are registered, set up and cleaned up.
+
+    This layer does not provide a complete ZODB setup (and is
+    therefore much faster than complete functional setups) but does
+    only the registrations (which also takes some time, so running
+    this layer is slower than test cases that need none or only a
+    few registrations).
+
+    The registrations are done for all tests the layer is attached to
+    once before all these tests are run (and torn down once
+    afterwards).
+    
+    To make use of this layer, you have to write a
+    :mod:`unittest.TestCase` class that provides an attribute called
+    ``layer`` with this class as value like this::
+
+      import unittest
+      from waeup.sirp.testing import WAeUPSIRPUnitTestLayer
+      
+      class MyTestCase(unittest.TestCase):
+
+          layer = WAeUPSIRPUnitTestLayer
+
+          # per-test setups and real tests go here...
+          def test_foo(self):
+              self.assertEqual(1, 1)
+              return
+
+    """
+    @classmethod
+    def setUp(cls):
+        grokked = maybe_grok()
+        if grokked:
+            setUpZope(None)
+        return
+
+    @classmethod
+    def tearDown(cls):
+        cleanUpZope(None)
