~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_annotate.py

  • Committer: Martin Pool
  • Date: 2006-01-30 06:23:50 UTC
  • mfrom: (1534.1.17 integration)
  • Revision ID: mbp@sourcefrog.net-20060130062350-d6f25277ddcdfd79
[merge] robert's integration of much recent work

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import os
32
32
 
33
33
from bzrlib.branch import Branch
34
 
from bzrlib.clone import copy_branch
35
34
from bzrlib.errors import BzrCommandError
36
35
from bzrlib.osutils import has_symlinks
37
 
from bzrlib.selftest import TestCaseInTempDir, BzrTestBase
 
36
from bzrlib.tests import TestCaseInTempDir, BzrTestBase
38
37
from bzrlib.annotate import annotate_file
39
38
 
40
39
 
41
40
class TestAnnotate(TestCaseInTempDir):
 
41
    def setUp(self):
 
42
        super(TestAnnotate, self).setUp()
 
43
        b = Branch.initialize(u'.')
 
44
        self.build_tree_contents([('hello.txt', 'my helicopter\n'),
 
45
                                  ('nomail.txt', 'nomail\n')])
 
46
        b.working_tree().add(['hello.txt'])
 
47
        b.working_tree().commit('add hello', 
 
48
                                committer='test@user')
 
49
        b.working_tree().add(['nomail.txt'])
 
50
        b.working_tree().commit('add nomail', committer='no mail')
 
51
 
42
52
    def test_help_annotate(self):
43
53
        """Annotate command exists"""
44
54
        out, err = self.run_bzr_captured(['--no-plugins', 'annotate', '--help'])
 
55
 
 
56
    def test_annotate_cmd(self):
 
57
        out, err = self.run_bzr_captured(['annotate', 'hello.txt'])
 
58
        self.assertEquals(err, '')
 
59
        self.assertEqualDiff(out, '''\
 
60
    1 test@us | my helicopter
 
61
''')
 
62
 
 
63
    def test_no_mail(self):
 
64
        out, err = self.run_bzr_captured(['annotate', 'nomail.txt'])
 
65
        self.assertEquals(err, '')
 
66
        self.assertEqualDiff(out, '''\
 
67
    2 no mail | nomail
 
68
''')