Merge lp:~jelmer/brz/walkdirs into lp:brz

Proposed by Jelmer Vernooij on 2018-03-05
Status: Merged
Approved by: Jelmer Vernooij on 2018-03-05
Approved revision: 6878
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/walkdirs
Merge into: lp:brz
Diff against target: 81 lines (+17/-14)
1 file modified
breezy/tests/per_workingtree/test_walkdirs.py (+17/-14)
To merge this branch: bzr merge lp:~jelmer/brz/walkdirs
Reviewer Review Type Date Requested Status
Martin Packman 2018-03-05 Approve on 2018-03-05
Review via email: mp+340639@code.launchpad.net

Commit message

Fix some walkdir tests for workingtree formats without support for versioned directories.

Description of the change

Fix some walkdir tests for workingtree formats without support for versioned directories.

To post a comment you must log in.
Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/tests/per_workingtree/test_walkdirs.py'
2--- breezy/tests/per_workingtree/test_walkdirs.py 2018-03-02 00:38:34 +0000
3+++ breezy/tests/per_workingtree/test_walkdirs.py 2018-03-05 02:58:03 +0000
4@@ -116,8 +116,7 @@
5 [dirblocks[2].as_tuple()]
6 ),
7 ]
8- if tree.has_versioned_directories():
9- expected_dirblocks.append(
10+ expected_dirblocks.append(
11 (dirblocks[3].as_dir_tuple(),
12 []
13 ))
14@@ -198,14 +197,18 @@
15 link2_stat = os.lstat('link2')
16 expected_dirblocks = [
17 (('', tree.path2id('')),
18- [('dir1', 'dir1', 'file', dir1_stat, tree.path2id('dir1'), 'directory'),
19- ('dir2', 'dir2', 'symlink', dir2_stat, tree.path2id('dir2'), 'directory'),
20+ [('dir1', 'dir1', 'file', dir1_stat, tree.path2id('dir1'),
21+ 'directory' if tree.has_versioned_directories() else None),
22+ ('dir2', 'dir2', 'symlink', dir2_stat, tree.path2id('dir2'),
23+ 'directory' if tree.has_versioned_directories() else None),
24 ('file1', 'file1', 'directory', file1_stat, tree.path2id('file1'), 'file'),
25 ('file2', 'file2', 'symlink', file2_stat, tree.path2id('file2'), 'file'),
26 ('link1', 'link1', 'file', link1_stat, tree.path2id('link1'), 'symlink'),
27 ('link2', 'link2', 'directory', link2_stat, tree.path2id('link2'), 'symlink'),
28 ]
29- ),
30+ )]
31+ if tree.has_versioned_directories():
32+ expected_dirblocks.extend([
33 (('dir1', tree.path2id('dir1')),
34 [
35 ]
36@@ -213,7 +216,8 @@
37 (('dir2', tree.path2id('dir2')),
38 [
39 ]
40- ),
41+ )])
42+ expected_dirblocks.extend([
43 (('file1', None),
44 [
45 ]
46@@ -222,10 +226,9 @@
47 [
48 ]
49 ),
50- ]
51- tree.lock_read()
52- result = list(tree.walkdirs())
53- tree.unlock()
54+ ])
55+ with tree.lock_read():
56+ result = list(tree.walkdirs())
57 # check each return value for debugging ease.
58 for pos, item in enumerate(expected_dirblocks):
59 self.assertEqual(item, result[pos])
60@@ -263,7 +266,8 @@
61 else:
62 expected_dirblocks = [
63 (('', tree.path2id('')),
64- [('file1', 'file1', 'directory', file1_stat, tree.path2id('file1'), 'file'),
65+ [('dir1', 'dir1', 'file', dir1_stat, tree.path2id('dir1'), None),
66+ ('file1', 'file1', 'directory', file1_stat, tree.path2id('file1'), 'file'),
67 ]
68 ),
69 (('file1', None),
70@@ -271,9 +275,8 @@
71 ]
72 ),
73 ]
74- tree.lock_read()
75- result = list(tree.walkdirs())
76- tree.unlock()
77+ with tree.lock_read():
78+ result = list(tree.walkdirs())
79 # check each return value for debugging ease.
80 for pos, item in enumerate(expected_dirblocks):
81 self.assertEqual(item, result[pos])

Subscribers

People subscribed via source and target branches