From: richard Date: Mon, 9 Aug 2010 04:43:50 +0000 (+0000) Subject: force tests checking text output to work in the "C" locale X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0fe573c147034b3b82e25325133d5f0aebdfbbdb;p=roundup.git force tests checking text output to work in the "C" locale git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4513 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/test/db_test_base.py b/test/db_test_base.py index 0751216..381b21f 100644 --- a/test/db_test_base.py +++ b/test/db_test_base.py @@ -24,7 +24,8 @@ from roundup.anypy.sets_ import set from roundup.hyperdb import String, Password, Link, Multilink, Date, \ Interval, DatabaseError, Boolean, Number, Node from roundup.mailer import Mailer -from roundup import date, password, init, instance, configuration, support +from roundup import date, password, init, instance, configuration, \ + roundupdb, i18n from mocknull import MockNull @@ -1834,6 +1835,8 @@ class DBTest(MyTestCase): """Creates one issue with two attachments, one smaller and one larger than the set max_attachment_size. """ + old_translate_ = roundupdb._ + roundupdb._ = i18n.get_translation(language='C').gettext db = self.db db.config.NOSY_MAX_ATTACHMENT_SIZE = 4096 res = dict(mail_to = None, mail_msg = None) @@ -1860,6 +1863,7 @@ class DBTest(MyTestCase): self.assert_("File 'test2.txt' not attached" in mail_msg) self.assert_(base64.encodestring("yyy").rstrip() not in mail_msg) finally : + roundupdb._ = old_translate_ Mailer.smtp_send = backup class ROTest(MyTestCase): diff --git a/test/test_dates.py b/test/test_dates.py index 0dd8251..4c31588 100644 --- a/test/test_dates.py +++ b/test/test_dates.py @@ -23,11 +23,21 @@ import time import datetime import calendar +from roundup import date, i18n from roundup.date import Date, Interval, Range, fixTimeOverflow, \ get_timezone class DateTestCase(unittest.TestCase): + def setUp(self): + self.old_gettext_ = i18n.gettext + self.old_ngettext_ = i18n.ngettext + i18n.gettext = i18n.get_translation(language='C').gettext + i18n.ngettext = i18n.get_translation(language='C').ngettext + + def tearDown(self): + i18n.gettext = self.old_gettext_ + i18n.ngettext = self.old_ngettext_ def testDateInterval(self): ae = self.assertEqual diff --git a/test/test_mailgw.py b/test/test_mailgw.py index b4a8f95..600bc81 100644 --- a/test/test_mailgw.py +++ b/test/test_mailgw.py @@ -21,6 +21,7 @@ if not os.environ.has_key('SENDMAILDEBUG'): os.environ['SENDMAILDEBUG'] = 'mail-test.log' SENDMAILDEBUG = os.environ['SENDMAILDEBUG'] +from roundup import mailgw, i18n, roundupdb from roundup.mailgw import MailGW, Unauthorized, uidFromAddress, \ parseContent, IgnoreLoop, IgnoreBulk, MailUsageError, MailUsageHelp from roundup import init, instance, password, rfc2822, __version__ @@ -119,6 +120,8 @@ class MailgwTestCase(unittest.TestCase, DiffHelper): count = 0 schema = 'classic' def setUp(self): + self.old_translate_ = mailgw._ + roundupdb._ = mailgw._ = i18n.get_translation(language='C').gettext MailgwTestCase.count = MailgwTestCase.count + 1 # and open the database / "instance" @@ -141,6 +144,7 @@ class MailgwTestCase(unittest.TestCase, DiffHelper): address='rgg@test.test', roles='User') def tearDown(self): + roundupdb._ = mailgw._ = self.old_translate_ if os.path.exists(SENDMAILDEBUG): os.remove(SENDMAILDEBUG) self.db.close()