~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_locale.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2011 Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
#
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
16
16
 
17
17
"""Test that bzr handles locales in a reasonable way"""
18
18
 
 
19
import os
19
20
import sys
20
21
 
21
22
from bzrlib import (
41
42
                    timestamp=1156451297.96, timezone=0)
42
43
        self.tree = tree
43
44
 
44
 
    def run_log_quiet_long(self, args, env_changes={}):
45
 
        cmd = ['--no-aliases', '--no-plugins', '-Oprogress_bar=none',
46
 
               'log', '-q', '--log-format=long']
47
 
        cmd.extend(args)
48
 
        return self.run_bzr_subprocess(cmd, env_changes=env_changes)
49
 
 
50
45
    def test_log_C(self):
51
46
        self.disable_missing_extensions_warning()
52
 
        out, err = self.run_log_quiet_long(
53
 
            ['tree'],
54
 
            # C is not necessarily the default locale, so set both LANG and
55
 
            # LC_ALL explicitly because LC_ALL is preferred on (some?) Linux
56
 
            # systems but only LANG is respected on Windows.
57
 
            env_changes={'LANG': 'C', 'LC_ALL': 'C', 'LC_CTYPE':None,
58
 
                         'LANGUAGE':None})
 
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})
59
51
        self.assertEqual('', err)
60
52
        self.assertEqualDiff("""\
61
53
------------------------------------------------------------
68
60
""", out)
69
61
 
70
62
    def test_log_BOGUS(self):
71
 
        out, err = self.run_log_quiet_long(
72
 
            ['tree'],
73
 
            env_changes={'LANG':'BOGUS', 'LC_ALL':None, 'LC_CTYPE':None,
74
 
                         'LANGUAGE':None})
 
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})
75
67
        self.assertStartsWith(err, 'bzr: warning: unsupported locale setting')
76
68
        self.assertEqualDiff("""\
77
69
------------------------------------------------------------
82
74
message:
83
75
  Unicode ? commit
84
76
""", out)
85
 
 
86
 
 
87
 
class TestMultibyteCodecs(tests.TestCaseWithTransport):
88
 
    """Tests for quirks of multibyte encodings and their python codecs"""
89
 
 
90
 
    def test_plugins_mbcs(self):
91
 
        """Ensure the plugins command works with cjkcodecs, see lp:754082"""
92
 
        self.disable_missing_extensions_warning()
93
 
        out, err = self.run_bzr(["plugins"], encoding="EUC-JP")
94
 
        # The output is tested in bt.test_plugins rather than here
95
 
        self.assertEqual("", err)