138
140
def test_walkdirs_type_changes(self):
139
141
"""Walkdir shows the actual kinds on disk and the recorded kinds."""
142
if not has_symlinks():
143
raise TestSkipped('No symlink support')
140
144
tree = self.make_branch_and_tree('.')
141
145
paths = ['file1', 'file2', 'dir1/', 'dir2/']
142
146
ids = ['file1', 'file2', 'dir1', 'dir2']
199
203
for pos, item in enumerate(expected_dirblocks):
200
204
self.assertEqual(item, result[pos])
201
205
self.assertEqual(len(expected_dirblocks), len(result))
207
def test_walkdirs_type_changes_wo_symlinks(self):
208
# similar to test_walkdirs_type_changes
209
# but don't use symlinks for safe testing on win32
210
tree = self.make_branch_and_tree('.')
211
paths = ['file1', 'dir1/']
212
ids = ['file1', 'dir1']
213
self.build_tree(paths)
215
tree.bzrdir.root_transport.delete_tree('dir1')
216
tree.bzrdir.root_transport.delete('file1')
217
changed_paths = ['dir1', 'file1/']
218
self.build_tree(changed_paths)
219
dir1_stat = os.lstat('dir1')
220
file1_stat = os.lstat('file1')
221
expected_dirblocks = [
222
(('', tree.path2id('')),
223
[('dir1', 'dir1', 'file', dir1_stat, 'dir1', 'directory'),
224
('file1', 'file1', 'directory', file1_stat, 'file1', 'file'),
237
result = list(tree.walkdirs())
239
# check each return value for debugging ease.
240
for pos, item in enumerate(expected_dirblocks):
241
self.assertEqual(item, result[pos])
242
self.assertEqual(len(expected_dirblocks), len(result))