diff --git a/CHANGES.txt b/CHANGES.txt index 1d32550..a4d30a2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,9 +5,13 @@ CHANGES 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) ------------------ diff --git a/buildout.cfg b/buildout.cfg index 47a5a66..533ae65 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -11,4 +11,4 @@ arguments = ['-p', 'testproj/src', '-s', 'testproj/site.zcml', [test] recipe = zc.recipe.testrunner -eggs = zope.app.locales [test] +eggs = zope.app.locales [test,zcml] diff --git a/setup.py b/setup.py index 826e2a2..637bb11 100644 --- a/setup.py +++ b/setup.py @@ -68,6 +68,10 @@ def read(*rnames): 'zope.tal', 'zope.testing', ], + zcml=[ + 'zope.i18n', + 'zope.configuration', + ], extract=[ 'zope.tal', 'zope.app.applicationcontrol', diff --git a/src/zope/app/locales/configure.zcml b/src/zope/app/locales/configure.zcml index 0598b91..bccc8a8 100644 --- a/src/zope/app/locales/configure.zcml +++ b/src/zope/app/locales/configure.zcml @@ -2,6 +2,8 @@ xmlns:i18n="http://namespaces.zope.org/i18n" i18n_domain="zope"> + + diff --git a/src/zope/app/locales/tests.py b/src/zope/app/locales/tests.py index c633d38..7e3b5e3 100644 --- a/src/zope/app/locales/tests.py +++ b/src/zope/app/locales/tests.py @@ -13,9 +13,12 @@ ############################################################################## """Tests for the message string extraction tool.""" -import os import doctest +import os import unittest +import zope.app.locales +import zope.component +import zope.configuration.xmlconfig class TestIsUnicodeInAllCatalog(unittest.TestCase): @@ -42,6 +45,29 @@ def test_is_unicode(self): 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(): @@ -49,7 +75,5 @@ def test_suite(): doctest.DocTestSuite('zope.app.locales.extract', optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,), unittest.makeSuite(TestIsUnicodeInAllCatalog), + unittest.makeSuite(ZCMLTest), )) - -if __name__ == '__main__': - unittest.main()