~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_foreign_vcs/test_branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2011, 2016 Canonical Ltd
 
1
# Copyright (C) 2009 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
19
19
 
20
20
 
21
21
from bzrlib.errors import (
22
 
    IncompatibleFormat,
23
22
    UnstackableBranchFormat,
24
23
    )
25
24
from bzrlib.revision import (
26
25
    NULL_REVISION,
27
26
    )
28
27
from bzrlib.tests import (
 
28
    TestCase,
29
29
    TestCaseWithTransport,
30
30
    )
31
31
 
61
61
        branch = self.make_branch()
62
62
        branch.set_parent("foobar")
63
63
 
 
64
    def test_break_lock(self):
 
65
        """Test that break_lock() works, even if it is a no-op."""
 
66
        branch = self.make_branch()
 
67
        branch.break_lock()
 
68
 
64
69
    def test_set_push_location(self):
65
70
        """Test that setting the push location works."""
66
71
        branch = self.make_branch()
101
106
    def test_null_revid_revno(self):
102
107
        """null: should return revno 0."""
103
108
        branch = self.make_branch()
104
 
        self.assertEqual(0, branch.revision_id_to_revno(NULL_REVISION))
 
109
        self.assertEquals(0, branch.revision_id_to_revno(NULL_REVISION))
105
110
 
106
111
    def test_get_stacked_on_url(self):
107
112
        """Test that get_stacked_on_url() behaves as expected.
119
124
 
120
125
    def test_last_revision_empty_branch(self):
121
126
        branch = self.make_empty_branch()
122
 
        self.assertEqual(NULL_REVISION, branch.last_revision())
123
 
        self.assertEqual(0, branch.revno())
124
 
        self.assertEqual((0, NULL_REVISION), branch.last_revision_info())
125
 
 
126
 
 
127
 
class ForeignBranchFormatTests(TestCaseWithTransport):
 
127
        self.assertEquals(NULL_REVISION, branch.last_revision())
 
128
        self.assertEquals(0, branch.revno())
 
129
        self.assertEquals((0, NULL_REVISION), branch.last_revision_info())
 
130
 
 
131
 
 
132
class ForeignBranchFormatTests(TestCase):
128
133
    """Basic tests for foreign branch format objects."""
129
134
 
130
135
    branch_format = None # Set to a BranchFormat instance by adapter
135
140
        Remote branches may be initializable on their own, but none currently
136
141
        support living in .bzr/branch.
137
142
        """
138
 
        bzrdir = self.make_bzrdir('dir')
139
 
        self.assertRaises(IncompatibleFormat, self.branch_format.initialize, bzrdir)
 
143
        self.assertRaises(NotImplementedError, self.branch_format.initialize, None)
140
144
 
141
145
    def test_get_format_description_type(self):
142
146
        self.assertIsInstance(self.branch_format.get_format_description(), str)
143
147
 
144
148
    def test_network_name(self):
145
149
        self.assertIsInstance(self.branch_format.network_name(), str)
 
150
 
 
151