~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils_encodings.py

  • Committer: Robert Collins
  • Date: 2010-06-25 20:34:05 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100625203405-c74lxd3enklhaqf9
``bzrlib.osutils.get_terminal_encoding`` will now only mutter its
selection when explicitly requested; this avoids many duplicate calls
being logged when helpers, wrappers and older code that manually calls
it are executed it is now logged deliberately by the ui setup code.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
        # and in the worst case, use osutils.get_user_encoding()
115
115
        self.assertEqual('user_encoding', osutils.get_terminal_encoding())
116
116
 
 
117
    def test_get_terminal_encoding_silent(self):
 
118
        self.make_wrapped_streams('stdout_encoding',
 
119
                                  'stderr_encoding',
 
120
                                  'stdin_encoding')
 
121
        # Calling get_terminal_encoding should not mutter when silent=True is
 
122
        # passed.
 
123
        log = self.get_log()
 
124
        osutils.get_terminal_encoding()
 
125
        self.assertEqual(log, self.get_log())
 
126
 
 
127
    def test_get_terminal_encoding_trace(self):
 
128
        self.make_wrapped_streams('stdout_encoding',
 
129
                                  'stderr_encoding',
 
130
                                  'stdin_encoding')
 
131
        # Calling get_terminal_encoding should not mutter when silent=True is
 
132
        # passed.
 
133
        log = self.get_log()
 
134
        osutils.get_terminal_encoding(trace=True)
 
135
        self.assertNotEqual(log, self.get_log())
 
136
 
117
137
    def test_terminal_cp0(self):
118
138
        # test cp0 encoding (Windows returns cp0 when there is no encoding)
119
139
        self.make_wrapped_streams('cp0',