~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils_encodings.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-10-01 07:56:03 UTC
  • mfrom: (3224.5.40 faster-startup)
  • Revision ID: pqm@pqm.ubuntu.com-20081001075603-s9nynw8y85fmrprj
Reduce startup time by a small amount. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import os
22
22
import sys
23
23
 
24
 
import bzrlib
25
24
from bzrlib import (
26
25
    errors,
27
26
    osutils,
78
77
        self._stdout = sys.stdout
79
78
        self._stderr = sys.stderr
80
79
        self._stdin = sys.stdin
81
 
        self._user_encoding = bzrlib.user_encoding
 
80
        self._user_encoding = osutils._cached_user_encoding
82
81
 
83
82
        self.addCleanup(self._reset)
84
83
 
94
93
        sys.stderr.encoding = stderr_encoding
95
94
        sys.stdin = StringIOWrapper()
96
95
        sys.stdin.encoding = stdin_encoding
97
 
        bzrlib.user_encoding = user_encoding
 
96
        osutils._cached_user_encoding = user_encoding
98
97
        if enable_fake_encodings:
99
98
            fake_codec.add(stdout_encoding)
100
99
            fake_codec.add(stderr_encoding)
104
103
        sys.stdout = self._stdout
105
104
        sys.stderr = self._stderr
106
105
        sys.stdin = self._stdin
107
 
        bzrlib.user_encoding = self._user_encoding
 
106
        osutils._cached_user_encoding = self._user_encoding
108
107
 
109
108
    def test_get_terminal_encoding(self):
110
109
        self.make_wrapped_streams('stdout_encoding',
119
118
        self.assertEqual('stdin_encoding', osutils.get_terminal_encoding())
120
119
 
121
120
        sys.stdin.encoding = None
122
 
        # and in the worst case, use bzrlib.user_encoding
 
121
        # and in the worst case, use osutils.get_user_encoding()
123
122
        self.assertEqual('user_encoding', osutils.get_terminal_encoding())
124
123
 
125
124
    def test_terminal_cp0(self):