[Checkins] SVN: zope.i18n/trunk/ Make bin/test run the tests without any extras, bin/test-all runs the tests

Philipp von Weitershausen philikon at philikon.de
Sat Sep 27 06:53:17 EDT 2008


Log message for revision 91554:
  Make bin/test run the tests without any extras, bin/test-all runs the tests
  with all extras on all levels. The ZCML tests (which also test the [compile]
  extra) are on level 2 so they aren't picked up by bin/test.
  

Changed:
  U   zope.i18n/trunk/buildout.cfg
  U   zope.i18n/trunk/src/zope/i18n/tests/test_zcml.py

-=-
Modified: zope.i18n/trunk/buildout.cfg
===================================================================
--- zope.i18n/trunk/buildout.cfg	2008-09-27 10:49:47 UTC (rev 91553)
+++ zope.i18n/trunk/buildout.cfg	2008-09-27 10:53:16 UTC (rev 91554)
@@ -1,13 +1,12 @@
 [buildout]
 develop = . 
-parts = test test-compile
-find-links = http://download.zope.org/distribution/
+parts = test test-all
 
 [test]
 recipe = zc.recipe.testrunner
-eggs =
-    zope.i18n [zcml]
+eggs = zope.i18n
 
-[test-compile]
+[test-all]
 recipe = zc.recipe.testrunner
 eggs = zope.i18n [zcml,compile]
+defaults = ['--all']

Modified: zope.i18n/trunk/src/zope/i18n/tests/test_zcml.py
===================================================================
--- zope.i18n/trunk/src/zope/i18n/tests/test_zcml.py	2008-09-27 10:49:47 UTC (rev 91553)
+++ zope.i18n/trunk/src/zope/i18n/tests/test_zcml.py	2008-09-27 10:53:16 UTC (rev 91554)
@@ -25,7 +25,6 @@
 
 import zope.i18n.tests
 from zope.i18n.interfaces import ITranslationDomain
-from zope.i18n.compile import HAS_PYTHON_GETTEXT
 from zope.i18n import config
 
 template = """\
@@ -37,6 +36,9 @@
 
 class DirectivesTest(PlacelessSetup, unittest.TestCase):
 
+    # This test suite needs the [zcml] and [compile] extra dependencies
+    level = 2
+
     def setUp(self):
         from zope.configuration import xmlconfig
         super(DirectivesTest, self).setUp()
@@ -112,40 +114,36 @@
         msg = util.translate(u'New Language', target_language='en')
         self.assertEquals(msg, u'New Language translated')
 
-    if HAS_PYTHON_GETTEXT:
-        def testRegisterAndCompileTranslations(self):
-            from zope.configuration import xmlconfig
-            config.COMPILE_MO_FILES = True
-            self.assert_(queryUtility(ITranslationDomain) is None)
+    def testRegisterAndCompileTranslations(self):
+        from zope.configuration import xmlconfig
+        config.COMPILE_MO_FILES = True
+        self.assert_(queryUtility(ITranslationDomain) is None)
 
-            # Copy an old and outdated file over, so we can test if the
-            # newer file check works
-            testpath = os.path.join(os.path.dirname(zope.i18n.tests.__file__))
-            basepath = os.path.join(testpath, 'locale3', 'en', 'LC_MESSAGES')
-            in_ = os.path.join(basepath, 'zope-i18n.in')
-            path = os.path.join(basepath, 'zope-i18n.mo')
-            shutil.copy2(in_, path)
+        # Copy an old and outdated file over, so we can test if the
+        # newer file check works
+        testpath = os.path.join(os.path.dirname(zope.i18n.tests.__file__))
+        basepath = os.path.join(testpath, 'locale3', 'en', 'LC_MESSAGES')
+        in_ = os.path.join(basepath, 'zope-i18n.in')
+        path = os.path.join(basepath, 'zope-i18n.mo')
+        shutil.copy2(in_, path)
 
-            xmlconfig.string(
-                template % '''
-                <configure package="zope.i18n.tests">
-                <i18n:registerTranslations directory="locale3" />
-                </configure>
-                ''', self.context)
-            util = getUtility(ITranslationDomain, 'zope-i18n')
-            self.assertEquals(util._catalogs,
-                              {'test': ['test'], 'en': [unicode(path)]})
+        xmlconfig.string(
+            template % '''
+            <configure package="zope.i18n.tests">
+            <i18n:registerTranslations directory="locale3" />
+            </configure>
+            ''', self.context)
+        util = getUtility(ITranslationDomain, 'zope-i18n')
+        self.assertEquals(util._catalogs,
+                          {'test': ['test'], 'en': [unicode(path)]})
 
-            msg = util.translate(u"I'm a newer file", target_language='en')
-            self.assertEquals(msg, u"I'm a newer file translated")
+        msg = util.translate(u"I'm a newer file", target_language='en')
+        self.assertEquals(msg, u"I'm a newer file translated")
 
-            util = getUtility(ITranslationDomain, 'zope-i18n2')
-            msg = util.translate(u"I'm a new file", target_language='en')
-            self.assertEquals(msg, u"I'm a new file translated")
+        util = getUtility(ITranslationDomain, 'zope-i18n2')
+        msg = util.translate(u"I'm a new file", target_language='en')
+        self.assertEquals(msg, u"I'm a new file translated")
 
 
 def test_suite():
     return unittest.makeSuite(DirectivesTest)
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')



More information about the Checkins mailing list