~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_non_ascii.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:
20
20
import os
21
21
 
22
22
from bzrlib import osutils, urlutils
23
 
import bzrlib
24
23
from bzrlib.tests import TestCaseWithTransport, TestSkipped
25
24
from bzrlib.trace import mutter, note
26
25
 
31
30
    def setUp(self):
32
31
        super(TestNonAscii, self).setUp()
33
32
        self._orig_email = os.environ.get('BZR_EMAIL', None)
34
 
        self._orig_encoding = bzrlib.user_encoding
 
33
        self._orig_encoding = osutils._cached_user_encoding
35
34
 
36
 
        bzrlib.user_encoding = self.encoding
 
35
        osutils._cached_user_encoding = self.encoding
37
36
        email = self.info['committer'] + ' <joe@foo.com>'
38
 
        os.environ['BZR_EMAIL'] = email.encode(bzrlib.user_encoding)
 
37
        os.environ['BZR_EMAIL'] = email.encode(osutils.get_user_encoding())
39
38
        self.create_base()
40
39
 
41
40
    def tearDown(self):
44
43
        else:
45
44
            if os.environ.get('BZR_EMAIL', None) is not None:
46
45
                del os.environ['BZR_EMAIL']
47
 
        bzrlib.user_encoding = self._orig_encoding
 
46
        osutils._cached_user_encoding = self._orig_encoding
48
47
        super(TestNonAscii, self).tearDown()
49
48
 
50
49
    def run_bzr_decode(self, args, encoding=None, fail=False, retcode=None,
57
56
            a UnicodeError.
58
57
        """
59
58
        if encoding is None:
60
 
            encoding = bzrlib.user_encoding
 
59
            encoding = osutils.get_user_encoding()
61
60
        try:
62
61
            out = self.run_bzr(args, output_encoding=encoding, encoding=encoding,
63
62
                retcode=retcode, working_dir=working_dir)[0]