/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
2255.7.83 by John Arbash Meinel
Update some obvious copyright headers to include 2007.
1
# Copyright (C) 2006, 2007 Canonical Ltd
1852.6.1 by Robert Collins
Start tree implementation tests.
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1852.6.1 by Robert Collins
Start tree implementation tests.
16
4523.1.4 by Martin Pool
Rename remaining *_implementations tests
17
"""Tests for the test trees used by the per_tree tests."""
1852.6.1 by Robert Collins
Start tree implementation tests.
18
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
19
from bzrlib import tests
4523.1.4 by Martin Pool
Rename remaining *_implementations tests
20
from bzrlib.tests import per_tree
5967.12.1 by Martin Pool
Move all test features into bzrlib.tests.features
21
from bzrlib.tests import (
22
    features,
23
    )
4523.1.4 by Martin Pool
Rename remaining *_implementations tests
24
25
26
class TestTreeShapes(per_tree.TestCaseWithTree):
1852.6.1 by Robert Collins
Start tree implementation tests.
27
28
    def test_empty_tree_no_parents(self):
1852.8.3 by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case.
29
        tree = self.make_branch_and_tree('.')
30
        tree = self.get_tree_no_parents_no_content(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
31
        tree.lock_read()
32
        self.addCleanup(tree.unlock)
1852.6.1 by Robert Collins
Start tree implementation tests.
33
        self.assertEqual([], tree.get_parent_ids())
34
        self.assertEqual([], tree.conflicts())
35
        self.assertEqual([], list(tree.unknowns()))
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
36
        self.assertEqual(['empty-root-id'], list(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
37
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
38
            [('', 'empty-root-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
39
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
40
41
    def test_abc_tree_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
42
        tree = self.make_branch_and_tree('.')
43
        tree = self.get_tree_no_parents_abc_content(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
44
        tree.lock_read()
45
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
46
        self.assertEqual([], tree.get_parent_ids())
47
        self.assertEqual([], tree.conflicts())
48
        self.assertEqual([], list(tree.unknowns()))
49
        # __iter__ has no strongly defined order
50
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
51
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
52
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
53
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
54
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
55
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
56
        self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
3363.2.7 by Aaron Bentley
Implement alterntative-to-inventory tests
57
        self.assertFalse(tree.is_executable('c-id', path='b/c'))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
58
59
    def test_abc_tree_content_2_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
60
        tree = self.make_branch_and_tree('.')
61
        tree = self.get_tree_no_parents_abc_content_2(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
62
        tree.lock_read()
63
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
64
        self.assertEqual([], tree.get_parent_ids())
65
        self.assertEqual([], tree.conflicts())
66
        self.assertEqual([], list(tree.unknowns()))
67
        # __iter__ has no strongly defined order
68
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
69
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
70
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
71
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
72
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
73
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
74
        self.assertEqualDiff('foobar\n', tree.get_file_text('a-id'))
75
        self.assertFalse(tree.is_executable('c-id'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
76
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
77
    def test_abc_tree_content_3_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
78
        tree = self.make_branch_and_tree('.')
79
        tree = self.get_tree_no_parents_abc_content_3(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
80
        tree.lock_read()
81
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
82
        self.assertEqual([], tree.get_parent_ids())
83
        self.assertEqual([], tree.conflicts())
84
        self.assertEqual([], list(tree.unknowns()))
85
        # __iter__ has no strongly defined order
86
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
87
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
88
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
89
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
90
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('b/c', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
91
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
92
        self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
93
        self.assertTrue(tree.is_executable('c-id'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
94
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
95
    def test_abc_tree_content_4_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
96
        tree = self.make_branch_and_tree('.')
97
        tree = self.get_tree_no_parents_abc_content_4(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
98
        tree.lock_read()
99
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
100
        self.assertEqual([], tree.get_parent_ids())
101
        self.assertEqual([], tree.conflicts())
102
        self.assertEqual([], list(tree.unknowns()))
103
        # __iter__ has no strongly defined order
104
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
105
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
106
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
107
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
108
            [('', 'root-id'), ('b', 'b-id'), ('d', 'a-id'), ('b/c', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
109
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
110
        self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
111
        self.assertFalse(tree.is_executable('c-id'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
112
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
113
    def test_abc_tree_content_5_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
114
        tree = self.make_branch_and_tree('.')
115
        tree = self.get_tree_no_parents_abc_content_5(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
116
        tree.lock_read()
117
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
118
        self.assertEqual([], tree.get_parent_ids())
119
        self.assertEqual([], tree.conflicts())
120
        self.assertEqual([], list(tree.unknowns()))
121
        # __iter__ has no strongly defined order
122
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
123
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
124
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
125
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
126
            [('', 'root-id'), ('b', 'b-id'), ('d', 'a-id'), ('b/c', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
127
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
128
        self.assertEqualDiff('bar\n', tree.get_file_text('a-id'))
129
        self.assertFalse(tree.is_executable('c-id'))
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
130
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
131
    def test_abc_tree_content_6_no_parents(self):
1852.8.7 by Robert Collins
Update tree_implementation test tree factories to be intertree ready.
132
        tree = self.make_branch_and_tree('.')
133
        tree = self.get_tree_no_parents_abc_content_6(tree)
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
134
        tree.lock_read()
135
        self.addCleanup(tree.unlock)
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
136
        self.assertEqual([], tree.get_parent_ids())
137
        self.assertEqual([], tree.conflicts())
138
        self.assertEqual([], list(tree.unknowns()))
139
        # __iter__ has no strongly defined order
140
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
141
            set(['root-id', 'a-id', 'b-id', 'c-id']),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
142
            set(tree.all_file_ids()))
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
143
        self.assertEqual(
1731.1.33 by Aaron Bentley
Revert no-special-root changes
144
            [('', 'root-id'), ('a', 'a-id'), ('b', 'b-id'), ('e', 'c-id')],
1852.6.9 by Robert Collins
Add more test trees to the tree-implementations tests.
145
            [(path, node.file_id) for path, node in tree.iter_entries_by_dir()])
146
        self.assertEqualDiff('contents of a\n', tree.get_file_text('a-id'))
147
        self.assertTrue(tree.is_executable('c-id'))
2294.1.1 by John Arbash Meinel
Track down some non-ascii deficiencies in commit logic.
148
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
149
    def test_tree_with_subdirs_and_all_content_types(self):
150
        # currently this test tree requires unicode. It might be good
151
        # to have it simply stop having the single unicode file in it
152
        # when dealing with a non-unicode filesystem.
5967.12.1 by Martin Pool
Move all test features into bzrlib.tests.features
153
        self.requireFeature(features.SymlinkFeature)
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
154
        tree = self.get_tree_with_subdirs_and_all_content_types()
2255.2.64 by John Arbash Meinel
Add the DirStateRevisionTree to the list of 'tree_implementations'
155
        tree.lock_read()
156
        self.addCleanup(tree.unlock)
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
157
        self.assertEqual([], tree.get_parent_ids())
158
        self.assertEqual([], tree.conflicts())
159
        self.assertEqual([], list(tree.unknowns()))
160
        # __iter__ has no strongly defined order
2255.2.17 by Robert Collins
tweaks - finishes off all the test_test_trees tests for dirstate.
161
        tree_root = tree.path2id('')
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
162
        self.assertEqual(
2255.2.17 by Robert Collins
tweaks - finishes off all the test_test_trees tests for dirstate.
163
            set([tree_root,
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
164
                '2file',
165
                '1top-dir',
166
                '1file-in-1topdir',
167
                '0dir-in-1topdir',
2255.2.107 by John Arbash Meinel
(working), fix dirstate to use utf8 file ids.
168
                 u'0utf\u1234file'.encode('utf8'),
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
169
                'symlink',
170
                 ]),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
171
            set(tree.all_file_ids()))
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
172
        # note that the order of the paths and fileids is deliberately
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
173
        # mismatched to ensure that the result order is path based.
174
        self.assertEqual(
2255.2.17 by Robert Collins
tweaks - finishes off all the test_test_trees tests for dirstate.
175
            [('', tree_root, 'directory'),
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
176
             ('0file', '2file', 'file'),
177
             ('1top-dir', '1top-dir', 'directory'),
2255.2.107 by John Arbash Meinel
(working), fix dirstate to use utf8 file ids.
178
             (u'2utf\u1234file', u'0utf\u1234file'.encode('utf8'), 'file'),
1852.15.1 by Robert Collins
Add a complex test tree for use with Tree.walkdirs.
179
             ('symlink', 'symlink', 'symlink'),
180
             ('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'),
181
             ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
182
            [(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
2255.2.106 by John Arbash Meinel
[merge] bzr.dev 2298 (broken)
183
2408.1.3 by Alexander Belchenko
tree_implementations: make usage of symlinks optional
184
    def test_tree_with_subdirs_and_all_content_types_wo_symlinks(self):
185
        # currently this test tree requires unicode. It might be good
186
        # to have it simply stop having the single unicode file in it
187
        # when dealing with a non-unicode filesystem.
188
        tree = self.get_tree_with_subdirs_and_all_supported_content_types(False)
189
        tree.lock_read()
190
        self.addCleanup(tree.unlock)
191
        self.assertEqual([], tree.get_parent_ids())
192
        self.assertEqual([], tree.conflicts())
193
        self.assertEqual([], list(tree.unknowns()))
194
        # __iter__ has no strongly defined order
195
        tree_root = tree.path2id('')
196
        self.assertEqual(
197
            set([tree_root,
198
                '2file',
199
                '1top-dir',
200
                '1file-in-1topdir',
201
                '0dir-in-1topdir',
202
                 u'0utf\u1234file'.encode('utf8'),
203
                 ]),
5837.2.2 by Jelmer Vernooij
Fix more uses of Tree.__iter__
204
            set(tree.all_file_ids()))
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
205
        # note that the order of the paths and fileids is deliberately
2408.1.3 by Alexander Belchenko
tree_implementations: make usage of symlinks optional
206
        # mismatched to ensure that the result order is path based.
207
        self.assertEqual(
208
            [('', tree_root, 'directory'),
209
             ('0file', '2file', 'file'),
210
             ('1top-dir', '1top-dir', 'directory'),
211
             (u'2utf\u1234file', u'0utf\u1234file'.encode('utf8'), 'file'),
212
             ('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'),
213
             ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
214
            [(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
215
2294.1.1 by John Arbash Meinel
Track down some non-ascii deficiencies in commit logic.
216
    def test_tree_with_utf8(self):
217
        tree = self.make_branch_and_tree('.')
218
        tree = self.get_tree_with_utf8(tree)
2294.1.2 by John Arbash Meinel
Track down and add tests that all tree.commit() can handle
219
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
220
        revision_id = u'r\xe9v-1'.encode('utf8')
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
221
        root_id = 'TREE_ROOT'
3638.3.12 by Vincent Ladeuil
Fix test missed in the previous commit (--starting-with doesn't
222
        bar_id = u'ba\N{Euro Sign}r-id'.encode('utf8')
223
        foo_id = u'fo\N{Euro Sign}o-id'.encode('utf8')
224
        baz_id = u'ba\N{Euro Sign}z-id'.encode('utf8')
225
        path_and_ids = [(u'', root_id, None, None),
226
                        (u'ba\N{Euro Sign}r', bar_id, root_id, revision_id),
227
                        (u'fo\N{Euro Sign}o', foo_id, root_id, revision_id),
228
                        (u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
229
                         baz_id, bar_id, revision_id),
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
230
                       ]
231
        tree.lock_read()
232
        try:
233
            path_entries = list(tree.iter_entries_by_dir())
234
        finally:
235
            tree.unlock()
236
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
237
        for expected, (path, ie) in zip(path_and_ids, path_entries):
238
            self.assertEqual(expected[0], path) # Paths should match
239
            self.assertIsInstance(path, unicode)
240
            self.assertEqual(expected[1], ie.file_id)
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
241
            self.assertIsInstance(ie.file_id, str)
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
242
            self.assertEqual(expected[2], ie.parent_id)
243
            if expected[2] is not None:
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
244
                self.assertIsInstance(ie.parent_id, str)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
245
            # WorkingTree's return None for the last modified revision
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
246
            if ie.revision is not None:
247
                self.assertIsInstance(ie.revision, str)
248
                if expected[0] != '':
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
249
                    # Some trees will preserve the revision id of the tree root,
250
                    # but not all will
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
251
                    self.assertEqual(revision_id, ie.revision)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
252
        self.assertEqual(len(path_and_ids), len(path_entries))
253
        get_revision_id = getattr(tree, 'get_revision_id', None)
254
        if get_revision_id is not None:
255
            self.assertIsInstance(get_revision_id(), str)
256
        last_revision = getattr(tree, 'last_revision', None)
257
        if last_revision is not None:
258
            self.assertIsInstance(last_revision(), str)
259
2294.1.2 by John Arbash Meinel
Track down and add tests that all tree.commit() can handle
260
    def test_tree_with_merged_utf8(self):
261
        tree = self.make_branch_and_tree('.')
262
        tree = self.get_tree_with_merged_utf8(tree)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
263
264
        revision_id_1 = u'r\xe9v-1'.encode('utf8')
265
        revision_id_2 = u'r\xe9v-2'.encode('utf8')
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
266
        root_id = 'TREE_ROOT'
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
267
        bar_id = u'ba\N{Euro Sign}r-id'.encode('utf8')
268
        foo_id = u'fo\N{Euro Sign}o-id'.encode('utf8')
269
        baz_id = u'ba\N{Euro Sign}z-id'.encode('utf8')
270
        qux_id = u'qu\N{Euro Sign}x-id'.encode('utf8')
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
271
        path_and_ids = [(u'', root_id, None, None),
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
272
                        (u'ba\N{Euro Sign}r', bar_id, root_id, revision_id_1),
273
                        (u'fo\N{Euro Sign}o', foo_id, root_id, revision_id_1),
274
                        (u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
275
                         baz_id, bar_id, revision_id_1),
276
                        (u'ba\N{Euro Sign}r/qu\N{Euro Sign}x',
277
                         qux_id, bar_id, revision_id_2),
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
278
                       ]
279
        tree.lock_read()
280
        try:
281
            path_entries = list(tree.iter_entries_by_dir())
282
        finally:
283
            tree.unlock()
284
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
285
        for (epath, efid, eparent, erev), (path, ie) in zip(path_and_ids,
286
                                                            path_entries):
287
            self.assertEqual(epath, path) # Paths should match
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
288
            self.assertIsInstance(path, unicode)
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
289
            self.assertEqual(efid, ie.file_id)
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
290
            self.assertIsInstance(ie.file_id, str)
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
291
            self.assertEqual(eparent, ie.parent_id)
292
            if eparent is not None:
2294.1.10 by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass
293
                self.assertIsInstance(ie.parent_id, str)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
294
            # WorkingTree's return None for the last modified revision
2294.1.7 by John Arbash Meinel
Add tests for parent ids in test_test_trees
295
            if ie.revision is not None:
296
                self.assertIsInstance(ie.revision, str)
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
297
                if epath == '':
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
298
                    # Some trees will preserve the revision id of the tree root,
299
                    # but not all will
300
                    continue
3638.3.11 by Vincent Ladeuil
Fix failing tests by avoiding unicode combinig encodings (we test
301
                self.assertEqual(erev, ie.revision)
2294.1.3 by John Arbash Meinel
Make sure the inventory enrtries returned are properly formed.
302
        self.assertEqual(len(path_and_ids), len(path_entries))
303
        get_revision_id = getattr(tree, 'get_revision_id', None)
304
        if get_revision_id is not None:
305
            self.assertIsInstance(get_revision_id(), str)
306
        last_revision = getattr(tree, 'last_revision', None)
307
        if last_revision is not None:
308
            self.assertIsInstance(last_revision(), str)