/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import os
20
20
import sys
21
21
 
22
 
from bzrlib.tests import TestCaseWithTransport
 
22
from bzrlib.tests import TestCaseWithTransport, TestSkipped
23
23
 
24
24
 
25
25
class TestLocale(TestCaseWithTransport):
30
30
        if sys.platform in ('win32',):
31
31
            raise TestSkipped('Windows does not respond to the LANG'
32
32
                              ' env variable')
33
 
        orig_progress = os.environ.get('BZR_PROGRESS_BAR')
34
 
        orig_lang = os.environ.get('LANG')
35
 
 
36
 
        def restore():
37
 
            if orig_lang is None:
38
 
                del os.environ['LANG']
39
 
            else:
40
 
                os.environ['LANG'] = orig_lang
41
 
            if orig_progress is None:
42
 
                del os.environ['BZR_PROGRESS_BAR']
43
 
            else:
44
 
                os.environ['BZR_PROGRESS_BAR'] = orig_progress
45
 
 
46
 
        self.addCleanup(restore)
47
 
        # Don't confuse things with progress bars
48
 
        os.environ['BZR_PROGRESS_BAR'] = 'none'
49
33
 
50
34
        tree = self.make_branch_and_tree('tree')
51
35
        self.build_tree(['tree/a'])
57
41
        self.tree = tree
58
42
 
59
43
    def test_log_C(self):
60
 
        os.environ['LANG'] = 'C'
61
44
        out, err = self.run_bzr_subprocess('--no-aliases', '--no-plugins',
62
 
                                           '-q', 'log', '--log-format=long',
63
 
                                           'tree')
 
45
               '-q', 'log', '--log-format=long', 'tree',
 
46
               env_changes={'LANG':'C', 'BZR_PROGRESS_BAR':'none',
 
47
                            'LC_ALL':None, 'LC_CTYPE':None, 'LANGUAGE':None})
64
48
        self.assertEqual('', err)
65
49
        self.assertEqualDiff("""\
66
50
------------------------------------------------------------
73
57
""", out)
74
58
 
75
59
    def test_log_BOGUS(self):
76
 
        os.environ['LANG'] = 'BOGUS'
77
60
        out, err = self.run_bzr_subprocess('--no-aliases', '--no-plugins',
78
 
                                           '-q', 'log', '--log-format=long',
79
 
                                           'tree')
 
61
               '-q', 'log', '--log-format=long', 'tree',
 
62
               env_changes={'LANG':'BOGUS', 'BZR_PROGRESS_BAR':'none',
 
63
                            'LC_ALL':None, 'LC_CTYPE':None, 'LANGUAGE':None})
80
64
        # XXX: This depends on the exact formatting of a locale.Error
81
65
        # as the first part of the string. It may be a little tempermental
82
66
        self.assertEqualDiff("""\