~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2006-08-28 16:00:08 UTC
  • mto: (1955.2.7 locale-35392)
  • mto: This revision was merged to the branch mainline in revision 1974.
  • Revision ID: john@arbash-meinel.com-20060828160008-030ae3ee0524bd43
run_bzr_subprocess() can take an env_changes parameter

This lets us set explicit environment variables in the spawned bzr instance

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