[Checkins] SVN: zope.annotation/trunk/ include zcml dependencies in configure.zcml, require the necessary packages via a zcml extra, added tests for zcml

Thomas Lotze tl at gocept.com
Tue Feb 15 10:46:28 EST 2011


Log message for revision 120346:
  include zcml dependencies in configure.zcml, require the necessary packages via a zcml extra, added tests for zcml

Changed:
  U   zope.annotation/trunk/CHANGES.txt
  U   zope.annotation/trunk/buildout.cfg
  U   zope.annotation/trunk/setup.py
  U   zope.annotation/trunk/src/zope/annotation/configure.zcml
  A   zope.annotation/trunk/src/zope/annotation/tests/test_configure.py

-=-
Modified: zope.annotation/trunk/CHANGES.txt
===================================================================
--- zope.annotation/trunk/CHANGES.txt	2011-02-15 09:54:38 UTC (rev 120345)
+++ zope.annotation/trunk/CHANGES.txt	2011-02-15 15:46:28 UTC (rev 120346)
@@ -2,10 +2,11 @@
 CHANGES
 =======
 
-3.5.1 (unreleased)
+3.6.0 (unreleased)
 ------------------
 
-- ...
+- Include zcml dependencies in configure.zcml, require the necessary packages
+  via a zcml extra, added tests for zcml.
 
 3.5.0 (2009-09-07)
 ------------------

Modified: zope.annotation/trunk/buildout.cfg
===================================================================
--- zope.annotation/trunk/buildout.cfg	2011-02-15 09:54:38 UTC (rev 120345)
+++ zope.annotation/trunk/buildout.cfg	2011-02-15 15:46:28 UTC (rev 120346)
@@ -4,7 +4,7 @@
 
 [test]
 recipe = zc.recipe.testrunner
-eggs = zope.annotation [test]
+eggs = zope.annotation [test,zcml]
 
 [ctags]
 recipe = z3c.recipe.tag:tags

Modified: zope.annotation/trunk/setup.py
===================================================================
--- zope.annotation/trunk/setup.py	2011-02-15 09:54:38 UTC (rev 120345)
+++ zope.annotation/trunk/setup.py	2011-02-15 15:46:28 UTC (rev 120346)
@@ -27,7 +27,7 @@
 
 setup(
     name='zope.annotation',
-    version='3.5.1dev',
+    version='3.6.0dev',
     url='http://pypi.python.org/pypi/zope.annotation',
     license='ZPL 2.1',
     description='Object annotation mechanism',
@@ -59,6 +59,10 @@
                       ],
     extras_require=dict(
         test=['zope.testing'],
+        zcml=[
+            'zope.component[zcml]',
+            'zope.configuration',
+            ],
         ),
     include_package_data=True,
     zip_safe=False,

Modified: zope.annotation/trunk/src/zope/annotation/configure.zcml
===================================================================
--- zope.annotation/trunk/src/zope/annotation/configure.zcml	2011-02-15 09:54:38 UTC (rev 120345)
+++ zope.annotation/trunk/src/zope/annotation/configure.zcml	2011-02-15 15:46:28 UTC (rev 120346)
@@ -1,5 +1,7 @@
 <configure xmlns="http://namespaces.zope.org/zope">
 
+  <include file="meta.zcml" package="zope.component" />
+
   <adapter
       for=".interfaces.IAttributeAnnotatable"
       provides=".interfaces.IAnnotations"

Added: zope.annotation/trunk/src/zope/annotation/tests/test_configure.py
===================================================================
--- zope.annotation/trunk/src/zope/annotation/tests/test_configure.py	                        (rev 0)
+++ zope.annotation/trunk/src/zope/annotation/tests/test_configure.py	2011-02-15 15:46:28 UTC (rev 120346)
@@ -0,0 +1,42 @@
+##############################################################################
+#
+# Copyright (c) 2011 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+import zope.annotation
+import zope.component
+import zope.configuration.xmlconfig
+
+
+class ZCMLTest(unittest.TestCase):
+
+    def test_configure_zcml_should_be_loadable(self):
+        try:
+            zope.configuration.xmlconfig.XMLConfig(
+                'configure.zcml', zope.annotation)()
+        except Exception, e:
+            self.fail(e)
+
+    def test_configure_should_register_n_components(self):
+        gsm = zope.component.getGlobalSiteManager()
+        u_count = len(list(gsm.registeredUtilities()))
+        a_count = len(list(gsm.registeredAdapters()))
+        s_count = len(list(gsm.registeredSubscriptionAdapters()))
+        h_count = len(list(gsm.registeredHandlers()))
+        zope.configuration.xmlconfig.XMLConfig(
+            'configure.zcml', zope.annotation)()
+        self.assertEqual(u_count + 2, len(list(gsm.registeredUtilities())))
+        self.assertEqual(a_count + 2, len(list(gsm.registeredAdapters())))
+        self.assertEqual(
+            s_count, len(list(gsm.registeredSubscriptionAdapters())))
+        self.assertEqual(h_count, len(list(gsm.registeredHandlers())))


Property changes on: zope.annotation/trunk/src/zope/annotation/tests/test_configure.py
___________________________________________________________________
Added: svn:keywords
   + Id Rev Date
Added: svn:eol-style
   + native



More information about the checkins mailing list