~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

[merge] robertc: file encoding tests, and run all tests in C locale as well as default

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from bzrlib.msgeditor import make_commit_message_template
24
24
from bzrlib.tests import TestCaseInTempDir, TestSkipped
25
25
 
26
 
from bzrlib.tests.treeshape import build_tree_contents
27
 
 
28
 
 
29
 
def make_uncommitted_tree():
30
 
    """Build a branch with uncommitted changes in the cwd."""
31
 
    b = Branch.initialize('.')
32
 
    working_tree = b.working_tree()
33
 
    filename = u'hell\u00d8'
34
 
    try:
35
 
        build_tree_contents([(filename, 'contents of hello')])
36
 
    except UnicodeEncodeError:
37
 
        raise TestSkipped("can't build unicode working tree in "
 
26
 
 
27
class MsgEditorTest(TestCaseInTempDir):
 
28
 
 
29
    def make_uncommitted_tree(self):
 
30
        """Build a branch with uncommitted unicode named changes in the cwd."""
 
31
        b = Branch.initialize('.')
 
32
        working_tree = b.working_tree()
 
33
        filename = u'hell\u00d8'
 
34
        try:
 
35
            self.build_tree_contents([(filename, 'contents of hello')])
 
36
        except UnicodeEncodeError:
 
37
            raise TestSkipped("can't build unicode working tree in "
38
38
                "filesystem encoding %s" % sys.getfilesystemencoding())
39
 
    working_tree.add(filename)
40
 
    return working_tree
41
 
 
42
 
 
43
 
class MsgEditorTest(TestCaseInTempDir):
44
 
 
 
39
        working_tree.add(filename)
 
40
        return working_tree
 
41
    
45
42
    def test_commit_template(self):
46
43
        """Test building a commit message template"""
47
 
        working_tree = make_uncommitted_tree()
 
44
        working_tree = self.make_uncommitted_tree()
48
45
        template = make_commit_message_template(working_tree, None)
49
46
        self.assertEqualDiff(template,
50
47
u"""\