Code

force tests checking text output to work in the "C" locale
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 9 Aug 2010 04:43:50 +0000 (04:43 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 9 Aug 2010 04:43:50 +0000 (04:43 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4513 57a73879-2fb5-44c3-a270-3262357dd7e2

test/db_test_base.py
test/test_dates.py
test/test_mailgw.py

index 0751216a46c98df4eae88c2e58bdebf2aa9c75ea..381b21f48a4b43806b4e3051083159b82c9dc2d0 100644 (file)
@@ -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):
index 0dd825121304d76aa0e816d976e090079f298d48..4c315885ef77828aa4b7be4c6f2ca67f18866143 100644 (file)
@@ -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
index b4a8f95c56514bf4760af55a120660b86370298b..600bc81fdc2c350a5f4fb74c3ac1baa426b261d3 100644 (file)
@@ -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()