Merge lp:~jelmer/brz/skip-inventory into lp:brz

Proposed by Jelmer Vernooij on 2018-03-05
Status: Merged
Approved by: Jelmer Vernooij on 2018-03-06
Approved revision: 6879
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/skip-inventory
Merge into: lp:brz
Diff against target: 164 lines (+33/-24)
2 files modified
breezy/tests/per_workingtree/test_basis_inventory.py (+9/-0)
breezy/tests/per_workingtree/test_executable.py (+24/-24)
To merge this branch: bzr merge lp:~jelmer/brz/skip-inventory
Reviewer Review Type Date Requested Status
Martin Packman 2018-03-05 Approve on 2018-03-05
Review via email: mp+340637@code.launchpad.net

Commit message

Skip over some more inventory-specific stuff in tests for foreign branches.

Description of the change

Fix some more tests for foreign branches:

* Avoid passing in explicit revision ids
* Skip inventory-specific tests
* Use tree API rather than inventory where possible

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

Thanks!

review: Approve
The Breezy Bot (the-breezy-bot) wrote :

Running landing tests failed
https://ci.breezy-vcs.org/job/brz-dev/9/

lp:~jelmer/brz/skip-inventory updated on 2018-03-06
6878. By Jelmer Vernooij on 2018-03-06

Merge trunk.

6879. By Jelmer Vernooij on 2018-03-06

Fix test_executable test.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/tests/per_workingtree/test_basis_inventory.py'
--- breezy/tests/per_workingtree/test_basis_inventory.py 2017-08-07 19:09:47 +0000
+++ breezy/tests/per_workingtree/test_basis_inventory.py 2018-03-06 00:26:30 +0000
@@ -33,6 +33,10 @@
3333
34 # Make sure the basis file is created by a commit34 # Make sure the basis file is created by a commit
35 t = self.make_branch_and_tree('.')35 t = self.make_branch_and_tree('.')
36 if getattr(t, 'root_inventory', None) is None:
37 raise TestNotApplicable("not applicable to %r"
38 % (self.workingtree_format,))
39
36 b = t.branch40 b = t.branch
37 with open('a', 'wb') as f: f.write('a\n')41 with open('a', 'wb') as f: f.write('a\n')
38 t.add('a')42 t.add('a')
@@ -68,6 +72,11 @@
68 raise TestNotApplicable("not applicable to %r"72 raise TestNotApplicable("not applicable to %r"
69 % (self.workingtree_format,))73 % (self.workingtree_format,))
70 t = self.make_branch_and_tree('.')74 t = self.make_branch_and_tree('.')
75 if getattr(t, 'root_inventory', None) is None:
76 raise TestNotApplicable("not applicable to %r"
77 % (self.workingtree_format,))
78
79
71 b = t.branch80 b = t.branch
72 with open('a', 'wb') as f: f.write('a\n')81 with open('a', 'wb') as f: f.write('a\n')
73 t.add('a')82 t.add('a')
7483
=== modified file 'breezy/tests/per_workingtree/test_executable.py'
--- breezy/tests/per_workingtree/test_executable.py 2017-11-12 14:19:13 +0000
+++ breezy/tests/per_workingtree/test_executable.py 2018-03-06 00:26:30 +0000
@@ -56,7 +56,7 @@
56 the inventory is empty, just that the tree doesn't have them56 the inventory is empty, just that the tree doesn't have them
57 """57 """
58 tree.lock_read()58 tree.lock_read()
59 if not ignore_inv:59 if not ignore_inv and getattr(tree, 'root_inventory', None):
60 self.assertEqual(60 self.assertEqual(
61 [('', tree.root_inventory.root)],61 [('', tree.root_inventory.root)],
62 list(tree.root_inventory.iter_entries()))62 list(tree.root_inventory.iter_entries()))
@@ -68,14 +68,14 @@
6868
69 def commit_and_branch(self):69 def commit_and_branch(self):
70 """Commit the current tree, and create a second tree"""70 """Commit the current tree, and create a second tree"""
71 self.wt.commit('adding a,b', rev_id='r1')71 r1 = self.wt.commit('adding a,b')
72 # Now make sure that 'bzr branch' also preserves the72 # Now make sure that 'bzr branch' also preserves the
73 # executable bit73 # executable bit
74 dir2 = self.wt.branch.controldir.sprout('b2', revision_id='r1')74 dir2 = self.wt.branch.controldir.sprout('b2', revision_id=r1)
75 wt2 = dir2.open_workingtree()75 wt2 = dir2.open_workingtree()
76 self.assertEqual(['r1'], wt2.get_parent_ids())76 self.assertEqual([r1], wt2.get_parent_ids())
77 self.assertEqual('r1', wt2.branch.last_revision())77 self.assertEqual(r1, wt2.branch.last_revision())
78 return wt278 return wt2, r1
7979
80 def test_01_is_executable(self):80 def test_01_is_executable(self):
81 """Make sure that the tree was created and has the executable bit set"""81 """Make sure that the tree was created and has the executable bit set"""
@@ -88,14 +88,14 @@
8888
89 def test_03_after_commit(self):89 def test_03_after_commit(self):
90 """Commit the change, and check the history"""90 """Commit the change, and check the history"""
91 self.wt.commit('adding a,b', rev_id='r1')91 r1 = self.wt.commit('adding a,b')
9292
93 rev_tree = self.wt.branch.repository.revision_tree('r1')93 rev_tree = self.wt.branch.repository.revision_tree(r1)
94 self.check_exist(rev_tree)94 self.check_exist(rev_tree)
9595
96 def test_04_after_removed(self):96 def test_04_after_removed(self):
97 """Make sure reverting removed files brings them back correctly"""97 """Make sure reverting removed files brings them back correctly"""
98 self.wt.commit('adding a,b', rev_id='r1')98 r1 = self.wt.commit('adding a,b')
9999
100 # Make sure the entries are gone100 # Make sure the entries are gone
101 os.remove('b1/a')101 os.remove('b1/a')
@@ -105,24 +105,24 @@
105 # Make sure that revert is able to bring them back,105 # Make sure that revert is able to bring them back,
106 # and sets 'a' back to being executable106 # and sets 'a' back to being executable
107107
108 rev_tree = self.wt.branch.repository.revision_tree('r1')108 rev_tree = self.wt.branch.repository.revision_tree(r1)
109109
110 self.wt.revert(['a', 'b'], rev_tree, backups=False)110 self.wt.revert(['a', 'b'], rev_tree, backups=False)
111 self.check_exist(self.wt)111 self.check_exist(self.wt)
112112
113 def test_05_removed_and_committed(self):113 def test_05_removed_and_committed(self):
114 """Check that reverting to an earlier commit restores them"""114 """Check that reverting to an earlier commit restores them"""
115 self.wt.commit('adding a,b', rev_id='r1')115 r1 = self.wt.commit('adding a,b')
116116
117 # Now remove them again, and make sure that after a117 # Now remove them again, and make sure that after a
118 # commit, they are still marked correctly118 # commit, they are still marked correctly
119 os.remove('b1/a')119 os.remove('b1/a')
120 os.remove('b1/b')120 os.remove('b1/b')
121 self.wt.commit('removed', rev_id='r2')121 r2 = self.wt.commit('removed')
122122
123 self.check_empty(self.wt)123 self.check_empty(self.wt)
124124
125 rev_tree = self.wt.branch.repository.revision_tree('r1')125 rev_tree = self.wt.branch.repository.revision_tree(r1)
126 # Now revert back to the previous commit126 # Now revert back to the previous commit
127 self.wt.revert(old_tree=rev_tree, backups=False)127 self.wt.revert(old_tree=rev_tree, backups=False)
128128
@@ -131,38 +131,38 @@
131 def test_06_branch(self):131 def test_06_branch(self):
132 """branch b1=>b2 should preserve the executable bits"""132 """branch b1=>b2 should preserve the executable bits"""
133 # TODO: Maybe this should be a blackbox test133 # TODO: Maybe this should be a blackbox test
134 wt2 = self.commit_and_branch()134 wt2, r1 = self.commit_and_branch()
135135
136 self.check_exist(wt2)136 self.check_exist(wt2)
137137
138 def test_07_pull(self):138 def test_07_pull(self):
139 """Test that pull will handle bits correctly"""139 """Test that pull will handle bits correctly"""
140 wt2 = self.commit_and_branch()140 wt2, r1 = self.commit_and_branch()
141141
142 os.remove('b1/a')142 os.remove('b1/a')
143 os.remove('b1/b')143 os.remove('b1/b')
144 self.wt.commit('removed', rev_id='r2')144 r2 = self.wt.commit('removed')
145145
146 # now wt2 can pull and the files should be removed146 # now wt2 can pull and the files should be removed
147147
148 # Make sure pull will delete the files148 # Make sure pull will delete the files
149 wt2.pull(self.wt.branch)149 wt2.pull(self.wt.branch)
150 self.assertEqual(['r2'], wt2.get_parent_ids())150 self.assertEqual([r2], wt2.get_parent_ids())
151 self.assertEqual('r2', wt2.branch.last_revision())151 self.assertEqual(r2, wt2.branch.last_revision())
152 self.check_empty(wt2)152 self.check_empty(wt2)
153153
154 # Now restore the files on the first branch and commit154 # Now restore the files on the first branch and commit
155 # so that the second branch can pull the changes155 # so that the second branch can pull the changes
156 # and make sure that the executable bit has been copied156 # and make sure that the executable bit has been copied
157 rev_tree = self.wt.branch.repository.revision_tree('r1')157 rev_tree = self.wt.branch.repository.revision_tree(r1)
158 self.wt.revert(old_tree=rev_tree, backups=False)158 self.wt.revert(old_tree=rev_tree, backups=False)
159 self.wt.commit('resurrected', rev_id='r3')159 r3 = self.wt.commit('resurrected')
160160
161 self.check_exist(self.wt)161 self.check_exist(self.wt)
162162
163 wt2.pull(self.wt.branch)163 wt2.pull(self.wt.branch)
164 self.assertEqual(['r3'], wt2.get_parent_ids())164 self.assertEqual([r3], wt2.get_parent_ids())
165 self.assertEqual('r3', wt2.branch.last_revision())165 self.assertEqual(r3, wt2.branch.last_revision())
166 self.check_exist(wt2)166 self.check_exist(wt2)
167167
168 def test_08_no_op_revert(self):168 def test_08_no_op_revert(self):
@@ -170,8 +170,8 @@
170170
171 The bits shouldn't swap.171 The bits shouldn't swap.
172 """172 """
173 self.wt.commit('adding a,b', rev_id='r1')173 r1 = self.wt.commit('adding a,b')
174 rev_tree = self.wt.branch.repository.revision_tree('r1')174 rev_tree = self.wt.branch.repository.revision_tree(r1)
175 self.wt.revert(old_tree=rev_tree, backups=False)175 self.wt.revert(old_tree=rev_tree, backups=False)
176 self.check_exist(self.wt)176 self.check_exist(self.wt)
177177

Subscribers

People subscribed via source and target branches