[Checkins] SVN: zope.i18n/trunk/src/zope/i18n/tests/test_zcml.py defer imports to test methods so that the regular tests will run without the

Philipp von Weitershausen philikon at philikon.de
Sat Sep 27 06:49:20 EDT 2008


Log message for revision 91552:
  defer imports to test methods so that the regular tests will run without the
  [zcml] extra being installed.
  

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

-=-
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:48:20 UTC (rev 91551)
+++ zope.i18n/trunk/src/zope/i18n/tests/test_zcml.py	2008-09-27 10:49:19 UTC (rev 91552)
@@ -22,7 +22,6 @@
 from zope.component import getUtility
 from zope.component import queryUtility
 from zope.component.testing import PlacelessSetup
-from zope.configuration import xmlconfig
 
 import zope.i18n.tests
 from zope.i18n.interfaces import ITranslationDomain
@@ -39,6 +38,7 @@
 class DirectivesTest(PlacelessSetup, unittest.TestCase):
 
     def setUp(self):
+        from zope.configuration import xmlconfig
         super(DirectivesTest, self).setUp()
         self.context = xmlconfig.file('meta.zcml', zope.i18n)
         self.allowed = config.ALLOWED_LANGUAGES
@@ -49,6 +49,7 @@
         config.ALLOWED_LANGUAGES = self.allowed
 
     def testRegisterTranslations(self):
+        from zope.configuration import xmlconfig
         self.assert_(queryUtility(ITranslationDomain) is None)
         xmlconfig.string(
             template % '''
@@ -63,6 +64,7 @@
         self.assertEquals(util._catalogs.get('en'), [unicode(path)])
 
     def testAllowedTranslations(self):
+        from zope.configuration import xmlconfig
         self.assert_(queryUtility(ITranslationDomain) is None)
         config.ALLOWED_LANGUAGES = ('de', 'fr')
         xmlconfig.string(
@@ -78,6 +80,7 @@
                           {'test': ['test'], 'de': [unicode(path)]})
 
     def testRegisterDistributedTranslations(self):
+        from zope.configuration import xmlconfig
         self.assert_(queryUtility(ITranslationDomain) is None)
         xmlconfig.string(
             template % '''
@@ -111,6 +114,7 @@
 
     if HAS_PYTHON_GETTEXT:
         def testRegisterAndCompileTranslations(self):
+            from zope.configuration import xmlconfig
             config.COMPILE_MO_FILES = True
             self.assert_(queryUtility(ITranslationDomain) is None)
 



More information about the Checkins mailing list