~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Robey Pointer
  • Date: 2006-09-03 00:28:18 UTC
  • mfrom: (1981 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1996.
  • Revision ID: robey@lag.net-20060903002818-71ca5c7bfea93a26
merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
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'})
64
47
        self.assertEqual('', err)
65
48
        self.assertEqualDiff("""\
66
49
------------------------------------------------------------
73
56
""", out)
74
57
 
75
58
    def test_log_BOGUS(self):
76
 
        os.environ['LANG'] = 'BOGUS'
77
59
        out, err = self.run_bzr_subprocess('--no-aliases', '--no-plugins',
78
 
                                           '-q', 'log', '--log-format=long',
79
 
                                           'tree')
 
60
               '-q', 'log', '--log-format=long', 'tree',
 
61
               env_changes={'LANG':'BOGUS', 'BZR_PROGRESS_BAR':'none'})
80
62
        # XXX: This depends on the exact formatting of a locale.Error
81
63
        # as the first part of the string. It may be a little tempermental
82
64
        self.assertEqualDiff("""\