~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

(Martin <gz>) Change bb.test_non_ascii tests to skip earlier and use
        addCleanup, as tearDown semantics have changed with testtools.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
        self.addCleanup(setattr, osutils, "_cached_user_encoding",
 
44
            osutils._cached_user_encoding)
43
45
        osutils._cached_user_encoding = self.encoding
44
46
        email = self.info['committer'] + ' <joe@foo.com>'
45
47
        os.environ['BZR_EMAIL'] = email.encode(osutils.get_user_encoding())
46
48
        self.create_base()
47
49
 
48
 
    def tearDown(self):
49
 
        osutils._cached_user_encoding = self._orig_encoding
50
 
        super(TestNonAscii, self).tearDown()
51
 
 
52
50
    def run_bzr_decode(self, args, encoding=None, fail=False, retcode=None,
53
51
                       working_dir=None):
54
52
        """Run bzr and decode the output into a particular encoding.
98
96
                    ' using encoding "%s"'
99
97
                    % (path, fs_enc))
100
98
 
101
 
    def create_base(self):
 
99
    def _check_can_encode_paths(self):
102
100
        fs_enc = osutils._fs_enc
103
101
        terminal_enc = osutils.get_terminal_encoding()
104
102
        fname = self.info['filename']
118
116
                    ' (even though it is valid in filesystem encoding "%s")'
119
117
                    % (thing, terminal_enc, fs_enc))
120
118
 
 
119
    def create_base(self):
121
120
        wt = self.make_branch_and_tree('.')
122
121
        self.build_tree_contents([('a', 'foo\n')])
123
122
        wt.add('a')
128
127
        wt.add('b')
129
128
        wt.commit(self.info['message'])
130
129
 
 
130
        fname = self.info['filename']
131
131
        self.build_tree_contents([(fname, 'unicode filename\n')])
132
132
        wt.add(fname)
133
133
        wt.commit(u'And a unicode file\n')