~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

Don't encode unicode messages to UTF-8 in mutter() (the stream writer does it).

Use a codec wrapped log file in tests to match the real environment.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import tempfile
27
27
import unittest
28
28
import time
 
29
import codecs
29
30
 
30
31
import bzrlib.branch
31
32
import bzrlib.commands
254
255
        The file is removed as the test is torn down.
255
256
        """
256
257
        fileno, name = tempfile.mkstemp(suffix='.log', prefix='testbzr')
257
 
        self._log_file = os.fdopen(fileno, 'w+')
 
258
        encoder, decoder, stream_reader, stream_writer = codecs.lookup('UTF-8')
 
259
        self._log_file = stream_writer(os.fdopen(fileno, 'w+'))
258
260
        bzrlib.trace.enable_test_log(self._log_file)
259
261
        self._log_file_name = name
260
262
        self.addCleanup(self._finishLogFile)