[Checkins] SVN: zope.app.locales/trunk/ Include zcml dependencies in ``configure.zcml``, require the necessary packages via a `zcml` extra, added tests for zcml.
Michael Howitz
mh at gocept.com
Wed Mar 2 09:00:55 EST 2011
Log message for revision 120673:
Include zcml dependencies in ``configure.zcml``, require the necessary packages via a `zcml` extra, added tests for zcml.
Changed:
U zope.app.locales/trunk/CHANGES.txt
U zope.app.locales/trunk/buildout.cfg
U zope.app.locales/trunk/setup.py
U zope.app.locales/trunk/src/zope/app/locales/configure.zcml
U zope.app.locales/trunk/src/zope/app/locales/tests.py
-=-
Modified: zope.app.locales/trunk/CHANGES.txt
===================================================================
--- zope.app.locales/trunk/CHANGES.txt 2011-03-02 13:25:03 UTC (rev 120672)
+++ zope.app.locales/trunk/CHANGES.txt 2011-03-02 14:00:55 UTC (rev 120673)
@@ -5,9 +5,13 @@
3.6.3 (unreleased)
------------------
+- Include zcml dependencies in ``configure.zcml``, require the necessary
+ packages via a `zcml` extra, added tests for zcml.
+
- Using Python's ``doctest`` module instead of depreacted
``zope.testing.doctest``.
+
3.6.2 (2010-07-31)
------------------
Modified: zope.app.locales/trunk/buildout.cfg
===================================================================
--- zope.app.locales/trunk/buildout.cfg 2011-03-02 13:25:03 UTC (rev 120672)
+++ zope.app.locales/trunk/buildout.cfg 2011-03-02 14:00:55 UTC (rev 120673)
@@ -11,4 +11,4 @@
[test]
recipe = zc.recipe.testrunner
-eggs = zope.app.locales [test]
+eggs = zope.app.locales [test,zcml]
Modified: zope.app.locales/trunk/setup.py
===================================================================
--- zope.app.locales/trunk/setup.py 2011-03-02 13:25:03 UTC (rev 120672)
+++ zope.app.locales/trunk/setup.py 2011-03-02 14:00:55 UTC (rev 120673)
@@ -68,6 +68,10 @@
'zope.tal',
'zope.testing',
],
+ zcml=[
+ 'zope.i18n',
+ 'zope.configuration',
+ ],
extract=[
'zope.tal',
'zope.app.applicationcontrol',
Modified: zope.app.locales/trunk/src/zope/app/locales/configure.zcml
===================================================================
--- zope.app.locales/trunk/src/zope/app/locales/configure.zcml 2011-03-02 13:25:03 UTC (rev 120672)
+++ zope.app.locales/trunk/src/zope/app/locales/configure.zcml 2011-03-02 14:00:55 UTC (rev 120673)
@@ -2,6 +2,8 @@
xmlns:i18n="http://namespaces.zope.org/i18n"
i18n_domain="zope">
+ <include package="zope.i18n" file="meta.zcml" />
+
<i18n:registerTranslations directory="." />
</configure>
Modified: zope.app.locales/trunk/src/zope/app/locales/tests.py
===================================================================
--- zope.app.locales/trunk/src/zope/app/locales/tests.py 2011-03-02 13:25:03 UTC (rev 120672)
+++ zope.app.locales/trunk/src/zope/app/locales/tests.py 2011-03-02 14:00:55 UTC (rev 120673)
@@ -13,9 +13,12 @@
##############################################################################
"""Tests for the message string extraction tool."""
+import doctest
import os
-import doctest
import unittest
+import zope.app.locales
+import zope.component
+import zope.configuration.xmlconfig
class TestIsUnicodeInAllCatalog(unittest.TestCase):
@@ -42,14 +45,35 @@
The language is %s (zope.po).
Value of the message catalog should be in unicode""" % (lang,)
)
+class ZCMLTest(unittest.TestCase):
+ def test_configure_zcml_should_be_loadable(self):
+ try:
+ zope.configuration.xmlconfig.XMLConfig(
+ 'configure.zcml', zope.app.locales)()
+ 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.app.locales)()
+ self.assertEqual(u_count + 2, len(list(gsm.registeredUtilities())))
+ self.assertEqual(a_count, len(list(gsm.registeredAdapters())))
+ self.assertEqual(
+ s_count, len(list(gsm.registeredSubscriptionAdapters())))
+ self.assertEqual(h_count, len(list(gsm.registeredHandlers())))
+
+
+
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite('zope.app.locales.extract',
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,),
unittest.makeSuite(TestIsUnicodeInAllCatalog),
+ unittest.makeSuite(ZCMLTest),
))
-
-if __name__ == '__main__':
- unittest.main()
More information about the checkins
mailing list