~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

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
        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')