~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2011-05-10 07:46:15 UTC
  • mfrom: (5844 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5845.
  • Revision ID: jelmer@samba.org-20110510074615-eptod049ndjxc4i7
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for interface conformance of inventories of trees."""
18
18
 
19
19
 
20
 
from cStringIO import StringIO
21
 
import os
22
 
 
23
20
from bzrlib import (
24
21
    tests,
25
22
    )
26
23
from bzrlib.tests import (
27
 
    features,
28
24
    per_tree,
29
25
    )
30
26
from bzrlib.mutabletree import MutableTree
31
 
from bzrlib.tests import SymlinkFeature, TestSkipped
 
27
from bzrlib.tests import TestSkipped
 
28
from bzrlib.tree import InventoryTree
32
29
from bzrlib.transform import _PreviewTree
33
30
from bzrlib.uncommit import uncommit
34
31
 
140
137
 
141
138
    def test_canonical_path(self):
142
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")
143
143
        self.assertEqual('dir/file',
144
144
                         work_tree.get_canonical_inventory_path('Dir/File'))
145
145
 
146
146
    def test_canonical_path_before_commit(self):
147
147
        work_tree = self._make_canonical_test_tree(False)
148
 
        # 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.
149
151
        self.assertEqual('dir/file',
150
152
                         work_tree.get_canonical_inventory_path('Dir/File'))
151
153
 
152
154
    def test_canonical_path_dir(self):
153
155
        # check it works when asked for just the directory portion.
154
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")
155
160
        self.assertEqual('dir', work_tree.get_canonical_inventory_path('Dir'))
156
161
 
157
162
    def test_canonical_path_root(self):
158
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")
159
167
        self.assertEqual('', work_tree.get_canonical_inventory_path(''))
160
168
        self.assertEqual('/', work_tree.get_canonical_inventory_path('/'))
161
169
 
162
170
    def test_canonical_path_invalid_all(self):
163
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")
164
175
        self.assertEqual('foo/bar',
165
176
                         work_tree.get_canonical_inventory_path('foo/bar'))
166
177
 
167
178
    def test_canonical_invalid_child(self):
168
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")
169
183
        self.assertEqual('dir/None',
170
184
                         work_tree.get_canonical_inventory_path('Dir/None'))
171
185
 
180
194
        work_tree.add(['test/', 'test/file', 'Test'])
181
195
 
182
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")
183
200
        test_tree.lock_read()
184
201
        self.addCleanup(test_tree.unlock)
185
202