308
308
self.build_tree(tree)
309
309
expected_dirblocks = [
311
('0file', '0file', 'file'),
312
('1dir', '1dir', 'directory'),
313
('2file', '2file', 'file'),
316
('1dir/0file', '0file', 'file'),
317
('1dir/1dir', '1dir', 'directory'),
311
[('0file', '0file', 'file'),
312
('1dir', '1dir', 'directory'),
313
('2file', '2file', 'file'),
317
[('1dir/0file', '0file', 'file'),
318
('1dir/1dir', '1dir', 'directory'),
321
(('1dir/1dir', './1dir/1dir'),
323
327
found_bzrdir = False
324
for dirblock in osutils.walkdirs('.'):
328
for dirdetail, dirblock in osutils.walkdirs('.'):
325
329
if len(dirblock) and dirblock[0][1] == '.bzr':
326
330
# this tests the filtering of selected paths
327
331
found_bzrdir = True
329
result.append(dirblock)
333
result.append((dirdetail, dirblock))
331
335
self.assertTrue(found_bzrdir)
332
336
self.assertEqual(expected_dirblocks,
333
[[line[0:3] for line in block] for block in result])
337
[(dirinfo, [line[0:3] for line in block]) for dirinfo, block in result])
334
338
# you can search a subdir only, with a supplied prefix.
336
for dirblock in osutils.walkdirs('1dir', '1dir'):
340
for dirblock in osutils.walkdirs('./1dir', '1dir'):
337
341
result.append(dirblock)
338
342
self.assertEqual(expected_dirblocks[1:],
339
[[line[0:3] for line in block] for block in result])
343
[(dirinfo, [line[0:3] for line in block]) for dirinfo, block in result])
341
345
def assertPathCompare(self, path_less, path_greater):
342
346
"""check that path_less and path_greater compare correctly."""