summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-06-12 21:00:12 +0000
committerBarry Warsaw <barry@python.org>2002-06-12 21:00:12 +0000
commit209758b080a997c9841bc18ca6d8b4b32a89f84a (patch)
tree64e42054062028a7a8ed6a602dd374d7507b40bb
parentac24630f4363f33360904db1d44e4673cd2efd21 (diff)
downloadzope-i18n-209758b080a997c9841bc18ca6d8b4b32a89f84a.tar.gz
testdir(): Move the calculation of the test's dirctory into a separate
function. Minor code cleanups.
-rw-r--r--tests/testGlobalTranslationService.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/testGlobalTranslationService.py b/tests/testGlobalTranslationService.py
index 492aec5..dab3140 100644
--- a/tests/testGlobalTranslationService.py
+++ b/tests/testGlobalTranslationService.py
@@ -13,36 +13,36 @@
##############################################################################
"""This module tests the regular persistent Translation Service.
-$Id: testGlobalTranslationService.py,v 1.1 2002/06/12 18:38:58 srichter Exp $
+$Id: testGlobalTranslationService.py,v 1.2 2002/06/12 21:00:12 bwarsaw Exp $
"""
import unittest, sys, os
from Zope.I18n.GlobalTranslationService import GlobalTranslationService
from Zope.I18n.GettextMessageCatalog import GettextMessageCatalog
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())