1
# Copyright (C) 2006 Canonical Ltd
1
# Copyright (C) 2006 by Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
17
"""Test that bzr handles locales in a reasonable way"""
27
class TestLocale(tests.TestCaseWithTransport):
22
from bzrlib.tests import TestCaseWithTransport
25
class TestLocale(TestCaseWithTransport):
30
28
super(TestLocale, self).setUp()
32
30
if sys.platform in ('win32',):
33
raise tests.TestSkipped('Windows does not respond to the LANG'
31
raise TestSkipped('Windows does not respond to the LANG'
36
34
tree = self.make_branch_and_tree('tree')
37
35
self.build_tree(['tree/a'])
45
43
def test_log_C(self):
46
self.disable_missing_extensions_warning()
47
out, err = self.run_bzr_subprocess(
48
'--no-aliases --no-plugins log -q --log-format=long tree',
49
env_changes={'LANG':'C', 'BZR_PROGRESS_BAR':'none',
50
'LC_ALL':None, 'LC_CTYPE':None, 'LANGUAGE':None})
44
out, err = self.run_bzr_subprocess('--no-aliases', '--no-plugins',
45
'-q', 'log', '--log-format=long', 'tree',
46
env_changes={'LANG':'C', 'BZR_PROGRESS_BAR':'none'})
51
47
self.assertEqual('', err)
52
48
self.assertEqualDiff("""\
53
49
------------------------------------------------------------
62
58
def test_log_BOGUS(self):
63
out, err = self.run_bzr_subprocess(
64
'--no-aliases --no-plugins log -q --log-format=long tree',
65
env_changes={'LANG':'BOGUS', 'BZR_PROGRESS_BAR':'none',
66
'LC_ALL':None, 'LC_CTYPE':None, 'LANGUAGE':None})
67
self.assertStartsWith(err, 'bzr: warning: unsupported locale setting')
59
out, err = self.run_bzr_subprocess('--no-aliases', '--no-plugins',
60
'-q', 'log', '--log-format=long', 'tree',
61
env_changes={'LANG':'BOGUS', 'BZR_PROGRESS_BAR':'none'})
62
# XXX: This depends on the exact formatting of a locale.Error
63
# as the first part of the string. It may be a little tempermental
64
self.assertEqualDiff("""\
65
bzr: warning: unsupported locale setting
66
Could not what text encoding to use.
67
This error usually means your Python interpreter
68
doesn't support the locale set by $LANG (BOGUS)
69
Continuing with ascii encoding.
68
71
self.assertEqualDiff("""\
69
72
------------------------------------------------------------