~ubuntu-branches/ubuntu/gutsy/bzr/gutsy

« back to all changes in this revision

Viewing changes to bzrlib/tests/tree_implementations/test_test_trees.py

  • Committer: Bazaar Package Importer
  • Author(s): Etienne Goyer
  • Date: 2007-04-27 17:53:49 UTC
  • mfrom: (1.1.23 upstream)
  • Revision ID: james.westby@ubuntu.com-20070427175349-rvowqx994rfuikuu
Tags: 0.16~rc1-0ubuntu1
New upstream development release 

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for the test trees used by the tree_implementations tests."""
18
18
 
 
19
from bzrlib.osutils import has_symlinks
 
20
from bzrlib.tests import TestSkipped
19
21
from bzrlib.tests.tree_implementations import TestCaseWithTree
20
22
 
21
23
 
146
148
        # currently this test tree requires unicode. It might be good
147
149
        # to have it simply stop having the single unicode file in it
148
150
        # when dealing with a non-unicode filesystem.
 
151
        if not has_symlinks():
 
152
            raise TestSkipped('No symlink support')
149
153
        tree = self.get_tree_with_subdirs_and_all_content_types()
150
154
        tree.lock_read()
151
155
        self.addCleanup(tree.unlock)
176
180
             ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
177
181
            [(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
178
182
 
 
183
    def test_tree_with_subdirs_and_all_content_types_wo_symlinks(self):
 
184
        # currently this test tree requires unicode. It might be good
 
185
        # to have it simply stop having the single unicode file in it
 
186
        # when dealing with a non-unicode filesystem.
 
187
        tree = self.get_tree_with_subdirs_and_all_supported_content_types(False)
 
188
        tree.lock_read()
 
189
        self.addCleanup(tree.unlock)
 
190
        self.assertEqual([], tree.get_parent_ids())
 
191
        self.assertEqual([], tree.conflicts())
 
192
        self.assertEqual([], list(tree.unknowns()))
 
193
        # __iter__ has no strongly defined order
 
194
        tree_root = tree.path2id('')
 
195
        self.assertEqual(
 
196
            set([tree_root,
 
197
                '2file',
 
198
                '1top-dir',
 
199
                '1file-in-1topdir',
 
200
                '0dir-in-1topdir',
 
201
                 u'0utf\u1234file'.encode('utf8'),
 
202
                 ]),
 
203
            set(iter(tree)))
 
204
        # note that the order of the paths and fileids is deliberately 
 
205
        # mismatched to ensure that the result order is path based.
 
206
        self.assertEqual(
 
207
            [('', tree_root, 'directory'),
 
208
             ('0file', '2file', 'file'),
 
209
             ('1top-dir', '1top-dir', 'directory'),
 
210
             (u'2utf\u1234file', u'0utf\u1234file'.encode('utf8'), 'file'),
 
211
             ('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'),
 
212
             ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
 
213
            [(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
 
214
 
179
215
    def test_tree_with_utf8(self):
180
216
        tree = self.make_branch_and_tree('.')
181
217
        tree = self.get_tree_with_utf8(tree)