[Checkins] SVN: zope.component/branches/sylvain-zcmltestlayer/src/zope/component/test Improve the ZCMLFileLayer tests, get rid of the ZCMLStringLayer implementation

Martijn Faassen faassen at startifact.com
Thu Jan 21 11:19:31 EST 2010


Log message for revision 108362:
  Improve the ZCMLFileLayer tests, get rid of the ZCMLStringLayer implementation
  as somehow it doesn't work.
  

Changed:
  U   zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testfiles/components.py
  U   zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testfiles/testlayer.zcml
  U   zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testlayer.py
  U   zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testlayer.txt

-=-
Modified: zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testfiles/components.py
===================================================================
--- zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testfiles/components.py	2010-01-21 16:05:46 UTC (rev 108361)
+++ zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testfiles/components.py	2010-01-21 16:19:31 UTC (rev 108362)
@@ -25,6 +25,12 @@
 class IApp(IAppb):
     pass
 
+class IApp2(IAppb):
+    pass
+
+class IApp3(IAppb):
+    pass
+
 class IContent(Interface): pass
 
 class Content(object):
@@ -41,4 +47,14 @@
     a = 1
     def f(): pass
 
+class Comp2(object):
+    def __init__(self, context):
+        self.context = context
+
+class Comp3(object):
+    def __init__(self, context):
+        self.context = context
+
 comp = Comp()
+
+content = Content()

Modified: zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testfiles/testlayer.zcml
===================================================================
--- zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testfiles/testlayer.zcml	2010-01-21 16:05:46 UTC (rev 108361)
+++ zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testfiles/testlayer.zcml	2010-01-21 16:19:31 UTC (rev 108362)
@@ -2,8 +2,8 @@
   <include package="zope.component" file="meta.zcml" />
 
   <adapter 
-    factory="zope.component.testfiles.components.Comp"
-    provides="zope.component.testfiles.components.IApp"
+    factory="zope.component.testfiles.components.Comp2"
+    provides="zope.component.testfiles.components.IApp2"
     for="zope.component.testfiles.components.IContent" />
 
 </configure>

Modified: zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testlayer.py
===================================================================
--- zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testlayer.py	2010-01-21 16:05:46 UTC (rev 108361)
+++ zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testlayer.py	2010-01-21 16:19:31 UTC (rev 108362)
@@ -86,23 +86,7 @@
 
     def _load_zcml(self, context):
         raise NotImplementedError
-    
-class ZCMLStringLayer(ZCMLLayerBase):
-    """This layer can be used to run tests with a ZCML string loaded.
 
-    The ZCML string is assumed to include sufficient (meta)configuration
-    so that it can be interpreted itself. I.e. to create a ZCMLLayer
-    based on another ZCMLLayer's ZCML, just use a ZCML include
-    statement in your own ZCML to load it.
-    """
-    def __init__(self, package, zcml_string=None,
-                 name=None, features=None):
-        super(ZCMLStringLayer, self).__init__(package, name, features)
-        self.zcml_string = zcml_string
-
-    def _load_zcml(self, context):
-        return xmlconfig.string(self.zcml_string, context=context, execute=True)
-
 class ZCMLFileLayer(ZCMLLayerBase):
     """This layer can be used to run tests with a ZCML file loaded.
 

Modified: zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testlayer.txt
===================================================================
--- zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testlayer.txt	2010-01-21 16:05:46 UTC (rev 108361)
+++ zope.component/branches/sylvain-zcmltestlayer/src/zope/component/testlayer.txt	2010-01-21 16:19:31 UTC (rev 108362)
@@ -84,7 +84,7 @@
   ...        from zope import component
   ...        from zope.component.testfiles import components
   ...        self.assert_(isinstance(
-  ...            components.IApp(components.comp), components.Comp))
+  ...            components.IApp2(components.content), components.Comp2))
 
 Since the ZCML sets up an adapter, we expect the tests to pass::
 
@@ -97,3 +97,4 @@
     Ran 1 tests with 0 failures and 0 errors in ... seconds.
   Tearing down left over layers:
     Tear down zope.component.testfiles.ZCMLFileLayer in ... seconds.
+



More information about the checkins mailing list