From 3b56c80ced70807fc45520dcc514bf6f415d4143 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 13 Dec 2013 11:40:30 +0100 Subject: [PATCH] [FIX] attempt to fix issues of Locale.parse(None) returning None use Locale.default() instead of manually parsing the result of locale.getdefaultlocale() bzr revid: xmo@openerp.com-20131213104030-0tejn7i13yex975v --- openerp/tests/test_misc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openerp/tests/test_misc.py b/openerp/tests/test_misc.py index c5443cfd936..2f2e99c18d2 100644 --- a/openerp/tests/test_misc.py +++ b/openerp/tests/test_misc.py @@ -40,7 +40,6 @@ class test_countingstream(unittest2.TestCase): self.assertIsNone(next(s, None)) self.assertEqual(s.index, 0) -lname, _ = locale.getdefaultlocale() class TestPosixToBabel(unittest2.TestCase): def setUp(self): super(TestPosixToBabel, self).setUp() @@ -49,10 +48,11 @@ class TestPosixToBabel(unittest2.TestCase): def assert_eq(self, fmt, d=None): if d is None: d = self.d - ldml_format = misc.posix_to_ldml(fmt, locale=babel.Locale.parse(lname)) + locale = babel.Locale.default('LC_TIME') + ldml_format = misc.posix_to_ldml(fmt, locale=locale) self.assertEqual( d.strftime(fmt), - babel.dates.format_datetime(d, format=ldml_format), + babel.dates.format_datetime(d, format=ldml_format, locale=locale), "%r resulted in a different result than %r for %s" % ( ldml_format, fmt, d))