[Zope-Checkins] CVS: Zope3/lib/python/Zope/I18n/tests - testGlobalTranslationService.py:1.2
Barry Warsaw
barry@wooz.org
Wed, 12 Jun 2002 17:00:12 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/I18n/tests
In directory cvs.zope.org:/tmp/cvs-serv13505/lib/python/Zope/I18n/tests
Modified Files:
testGlobalTranslationService.py
Log Message:
testdir(): Move the calculation of the test's dirctory into a separate
function.
Minor code cleanups.
=== Zope3/lib/python/Zope/I18n/tests/testGlobalTranslationService.py 1.1 => 1.2 ===
from testITranslationService import TestITranslationService
+def testdir():
+ from Zope.I18n import tests
+ return os.path.dirname(tests.__file__)
+
class TestGlobalTranslationService(TestITranslationService):
def _getTranslationService(self):
service = GlobalTranslationService('default')
-
-
- from Zope.I18n import tests
- path = os.path.split(tests.__file__)[0]
+ path = testdir()
en_catalog = GettextMessageCatalog('en', 'default',
os.path.join(path, 'en-default.mo'))
de_catalog = GettextMessageCatalog('de', 'default',
os.path.join(path, 'de-default.mo'))
-
service.addCatalog(en_catalog)
service.addCatalog(de_catalog)
-
return service
def test_suite():
- loader=unittest.TestLoader()
+ loader = unittest.TestLoader()
return loader.loadTestsFromTestCase(TestGlobalTranslationService)
-if __name__=='__main__':
+
+if __name__ == '__main__':
unittest.TextTestRunner().run(test_suite())