[Checkins] SVN: zope.component/trunk/src/zope/component/testlayer.py Add eventtesting support for ZCMLLayerBase.

Sylvain Viollon sylvain at infrae.com
Thu Jan 21 13:08:41 EST 2010


Log message for revision 108365:
  Add eventtesting support for ZCMLLayerBase.
  

Changed:
  U   zope.component/trunk/src/zope/component/testlayer.py

-=-
Modified: zope.component/trunk/src/zope/component/testlayer.py
===================================================================
--- zope.component/trunk/src/zope/component/testlayer.py	2010-01-21 17:31:43 UTC (rev 108364)
+++ zope.component/trunk/src/zope/component/testlayer.py	2010-01-21 18:08:40 UTC (rev 108365)
@@ -16,8 +16,11 @@
 
 from zope.configuration import xmlconfig, config
 from zope.testing.cleanup import cleanUp
+from zope.component import provideHandler
 from zope.component.hooks import setHooks
+from zope.component.eventtesting import events, clearEvents
 
+
 class LayerBase(object):
     """Sane layer base class.
 
@@ -39,13 +42,13 @@
     The hack requires us to set __bases__, __module__ and
     __name__. This fools zope.testing into thinking that this layer
     instance is a class it can work with.
-    
+
     It'd be better if zope.testing just called a minimal API and
     didn't try to be fancy. Fancy layer inheritance mechanisms can
     then be implemented elsewhere if people want to. But unfortunately
     it does implement a fancy mechanism and we need to fool it.
     """
-    
+
     __bases__ = ()
 
     def __init__(self, package, name=None):
@@ -80,7 +83,11 @@
         for feature in self.features:
             context.provideFeature(feature)
         self.context = self._load_zcml(context)
+        provideHandler(events.append, (None,))
 
+    def testTearDown(self):
+        clearEvents()
+
     def tearDown(self):
         cleanUp()
 



More information about the checkins mailing list