~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_check.py

(jelmer) Fix some more tests when run against foreign bzr plugins. (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
20
20
 
 
21
from bzrlib.workingtree import InventoryWorkingTree
 
22
from bzrlib.tests import TestNotApplicable
 
23
 
21
24
 
22
25
class TestCheck(TestCaseWithWorkingTree):
23
26
 
24
27
    def test__get_check_refs_new(self):
25
28
        tree = self.make_branch_and_tree('tree')
 
29
        if not isinstance(tree, InventoryWorkingTree):
 
30
            raise TestNotApplicable(
 
31
                "_get_check_refs only relevant for inventory working trees")
26
32
        self.assertEqual(set([('trees', 'null:')]),
27
33
            set(tree._get_check_refs()))
28
34
 
30
36
        # with a basis, all current bzr trees cache it and so need the
31
37
        # inventory to cross-check.
32
38
        tree = self.make_branch_and_tree('tree')
 
39
        if not isinstance(tree, InventoryWorkingTree):
 
40
            raise TestNotApplicable(
 
41
                "_get_check_refs only relevant for inventory working trees")
33
42
        revid = tree.commit('first post')
34
43
        self.assertEqual(set([('trees', revid)]),
35
44
            set(tree._get_check_refs()))
37
46
    def test__check_with_refs(self):
38
47
        # _check can be called with a dict of the things required.
39
48
        tree = self.make_branch_and_tree('tree')
 
49
        if not isinstance(tree, InventoryWorkingTree):
 
50
            raise TestNotApplicable(
 
51
                "_get_check_refs only relevant for inventory working trees")
40
52
        tree.lock_write()
41
53
        self.addCleanup(tree.unlock)
42
54
        revid = tree.commit('first post')