~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin
  • Date: 2010-05-25 17:27:52 UTC
  • mfrom: (5254 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5257.
  • Revision ID: gzlist@googlemail.com-20100525172752-amm089xcikv968sw
Merge bzr.dev to unite with similar changes already made

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
38
38
 
39
39
    def setUp(self):
40
40
        super(TestNonAscii, self).setUp()
41
 
        self._orig_encoding = osutils._cached_user_encoding
 
41
        self._check_can_encode_paths()
42
42
 
43
 
        osutils._cached_user_encoding = self.encoding
 
43
        self.overrideAttr(osutils, '_cached_user_encoding', self.encoding)
44
44
        email = self.info['committer'] + ' <joe@foo.com>'
45
45
        os.environ['BZR_EMAIL'] = email.encode(osutils.get_user_encoding())
46
46
        self.create_base()
47
47
 
48
 
    def tearDown(self):
49
 
        osutils._cached_user_encoding = self._orig_encoding
50
 
        super(TestNonAscii, self).tearDown()
51
 
 
52
48
    def run_bzr_decode(self, args, encoding=None, fail=False, retcode=None,
53
49
                       working_dir=None):
54
50
        """Run bzr and decode the output into a particular encoding.
98
94
                    ' using encoding "%s"'
99
95
                    % (path, fs_enc))
100
96
 
101
 
    def create_base(self):
 
97
    def _check_can_encode_paths(self):
102
98
        fs_enc = osutils._fs_enc
103
99
        terminal_enc = osutils.get_terminal_encoding()
104
100
        fname = self.info['filename']
118
114
                    ' (even though it is valid in filesystem encoding "%s")'
119
115
                    % (thing, terminal_enc, fs_enc))
120
116
 
 
117
    def create_base(self):
121
118
        wt = self.make_branch_and_tree('.')
122
119
        self.build_tree_contents([('a', 'foo\n')])
123
120
        wt.add('a')
128
125
        wt.add('b')
129
126
        wt.commit(self.info['message'])
130
127
 
 
128
        fname = self.info['filename']
131
129
        self.build_tree_contents([(fname, 'unicode filename\n')])
132
130
        wt.add(fname)
133
131
        wt.commit(u'And a unicode file\n')