~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_tree/test_inv.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-04 20:44:14 UTC
  • mfrom: (5807.2.2 inventory-tree-tests)
  • Revision ID: pqm@pqm.ubuntu.com-20110504204414-j893hspmx3k1rki4
(jelmer) Skip per_tree tests that are InventoryTree-specific if they're run
 against non-inventory trees. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    )
26
26
from bzrlib.mutabletree import MutableTree
27
27
from bzrlib.tests import TestSkipped
 
28
from bzrlib.tree import InventoryTree
28
29
from bzrlib.transform import _PreviewTree
29
30
from bzrlib.uncommit import uncommit
30
31
 
136
137
 
137
138
    def test_canonical_path(self):
138
139
        work_tree = self._make_canonical_test_tree()
 
140
        if not isinstance(work_tree, InventoryTree):
 
141
            raise tests.TestNotApplicable(
 
142
                "test not applicable on non-inventory tests")
139
143
        self.assertEqual('dir/file',
140
144
                         work_tree.get_canonical_inventory_path('Dir/File'))
141
145
 
142
146
    def test_canonical_path_before_commit(self):
143
147
        work_tree = self._make_canonical_test_tree(False)
144
 
        # note: not committed.
 
148
        if not isinstance(work_tree, InventoryTree):
 
149
            raise tests.TestNotApplicable(
 
150
                "test not applicable on non-inventory tests")        # note: not committed.
145
151
        self.assertEqual('dir/file',
146
152
                         work_tree.get_canonical_inventory_path('Dir/File'))
147
153
 
148
154
    def test_canonical_path_dir(self):
149
155
        # check it works when asked for just the directory portion.
150
156
        work_tree = self._make_canonical_test_tree()
 
157
        if not isinstance(work_tree, InventoryTree):
 
158
            raise tests.TestNotApplicable(
 
159
                "test not applicable on non-inventory tests")
151
160
        self.assertEqual('dir', work_tree.get_canonical_inventory_path('Dir'))
152
161
 
153
162
    def test_canonical_path_root(self):
154
163
        work_tree = self._make_canonical_test_tree()
 
164
        if not isinstance(work_tree, InventoryTree):
 
165
            raise tests.TestNotApplicable(
 
166
                "test not applicable on non-inventory tests")
155
167
        self.assertEqual('', work_tree.get_canonical_inventory_path(''))
156
168
        self.assertEqual('/', work_tree.get_canonical_inventory_path('/'))
157
169
 
158
170
    def test_canonical_path_invalid_all(self):
159
171
        work_tree = self._make_canonical_test_tree()
 
172
        if not isinstance(work_tree, InventoryTree):
 
173
            raise tests.TestNotApplicable(
 
174
                "test not applicable on non-inventory tests")
160
175
        self.assertEqual('foo/bar',
161
176
                         work_tree.get_canonical_inventory_path('foo/bar'))
162
177
 
163
178
    def test_canonical_invalid_child(self):
164
179
        work_tree = self._make_canonical_test_tree()
 
180
        if not isinstance(work_tree, InventoryTree):
 
181
            raise tests.TestNotApplicable(
 
182
                "test not applicable on non-inventory tests")
165
183
        self.assertEqual('dir/None',
166
184
                         work_tree.get_canonical_inventory_path('Dir/None'))
167
185
 
176
194
        work_tree.add(['test/', 'test/file', 'Test'])
177
195
 
178
196
        test_tree = self._convert_tree(work_tree)
 
197
        if not isinstance(test_tree, InventoryTree):
 
198
            raise tests.TestNotApplicable(
 
199
                "test not applicable on non-inventory tests")
179
200
        test_tree.lock_read()
180
201
        self.addCleanup(test_tree.unlock)
181
202