~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

  • Committer: John Arbash Meinel
  • Author(s): Mark Hammond
  • Date: 2008-09-09 17:02:21 UTC
  • mto: This revision was merged to the branch mainline in revision 3697.
  • Revision ID: john@arbash-meinel.com-20080909170221-svim3jw2mrz0amp3
An updated transparent icon for bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    errors,
26
26
    msgeditor,
27
27
    osutils,
 
28
    tests,
28
29
    )
29
30
from bzrlib.branch import Branch
30
31
from bzrlib.config import ensure_config_dir_exists, config_filename
33
34
    edit_commit_message_encoded
34
35
)
35
36
from bzrlib.tests import (
 
37
    iter_suite_tests,
36
38
    probe_bad_non_ascii,
 
39
    split_suite_by_re,
37
40
    TestCaseWithTransport,
 
41
    TestNotApplicable,
38
42
    TestSkipped,
39
43
    )
 
44
from bzrlib.tests.EncodingAdapter import EncodingTestAdapter
40
45
from bzrlib.trace import mutter
41
46
 
42
47
 
 
48
def load_tests(standard_tests, module, loader):
 
49
    """Parameterize the test for tempfile creation with different encodings."""
 
50
    to_adapt, result = split_suite_by_re(standard_tests,
 
51
        "test__create_temp_file_with_commit_template_in_unicode_dir")
 
52
    for test in iter_suite_tests(to_adapt):
 
53
        result.addTests(EncodingTestAdapter().adapt(test))
 
54
    return result
 
55
 
 
56
 
43
57
class MsgEditorTest(TestCaseWithTransport):
44
58
 
45
59
    def make_uncommitted_tree(self):
243
257
                                    'infotext'])
244
258
        self.assertFileEqual(expected, msgfilename)
245
259
 
 
260
    def test__create_temp_file_with_commit_template_in_unicode_dir(self):
 
261
        self.requireFeature(tests.UnicodeFilenameFeature)
 
262
        if hasattr(self, 'info'):
 
263
            os.mkdir(self.info['directory'])
 
264
            os.chdir(self.info['directory'])
 
265
            msgeditor._create_temp_file_with_commit_template('infotext')
 
266
        else:
 
267
            raise TestNotApplicable('Test run elsewhere with non-ascii data.')
 
268
 
246
269
    def test__create_temp_file_with_empty_commit_template(self):
247
270
        # empty file
248
271
        create_file = msgeditor._create_temp_file_with_commit_template