Merge lp:~gz/bzr/delete_skipped_bound_sftp_tests_728252 into lp:bzr

Proposed by Martin Packman
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6502
Proposed branch: lp:~gz/bzr/delete_skipped_bound_sftp_tests_728252
Merge into: lp:bzr
Diff against target: 343 lines (+0/-328)
2 files modified
bzrlib/tests/per_branch/__init__.py (+0/-1)
bzrlib/tests/per_branch/test_bound_sftp.py (+0/-327)
To merge this branch: bzr merge lp:~gz/bzr/delete_skipped_bound_sftp_tests_728252
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+97388@code.launchpad.net

Commit message

Remove long-skipped bt.per_branch.test_bound_sftp tests

Description of the change

Removes an old test module that is unconditionally skipped. Even going back to lp:bzr/2.0 that's the case, so they have been providing no benefit for a long time. Just removing them will reduce the chance of future confusion, there doesn't seem to be much worthwhile trying to salvage from them.

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

R.I.P.

review: Approve
Revision history for this message
Martin Packman (gz) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/tests/per_branch/__init__.py'
2--- bzrlib/tests/per_branch/__init__.py 2011-10-05 12:51:41 +0000
3+++ bzrlib/tests/per_branch/__init__.py 2012-03-14 12:35:40 +0000
4@@ -149,7 +149,6 @@
5
6 def load_tests(standard_tests, module, loader):
7 per_branch_mod_names = [
8- 'bound_sftp',
9 'branch',
10 'break_lock',
11 'check',
12
13=== removed file 'bzrlib/tests/per_branch/test_bound_sftp.py'
14--- bzrlib/tests/per_branch/test_bound_sftp.py 2012-02-23 19:45:15 +0000
15+++ bzrlib/tests/per_branch/test_bound_sftp.py 1970-01-01 00:00:00 +0000
16@@ -1,327 +0,0 @@
17-# Copyright (C) 2005, 2006, 2007, 2009, 2010 Robey Pointer <robey@lag.net>, Canonical Ltd
18-#
19-# This program is free software; you can redistribute it and/or modify
20-# it under the terms of the GNU General Public License as published by
21-# the Free Software Foundation; either version 2 of the License, or
22-# (at your option) any later version.
23-#
24-# This program is distributed in the hope that it will be useful,
25-# but WITHOUT ANY WARRANTY; without even the implied warranty of
26-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27-# GNU General Public License for more details.
28-#
29-# You should have received a copy of the GNU General Public License
30-# along with this program; if not, write to the Free Software
31-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
32-
33-"""Tests for branches bound to an sftp branch."""
34-
35-
36-import os
37-
38-from bzrlib import (
39- branch,
40- controldir,
41- errors,
42- tests,
43- )
44-from bzrlib.tests import test_server
45-from bzrlib.transport import memory
46-
47-
48-class BoundSFTPBranch(tests.TestCaseWithTransport):
49-
50- def setUp(self):
51- tests.TestCaseWithTransport.setUp(self)
52- self.vfs_transport_factory = memory.MemoryServer
53- if self.transport_server is test_server.LocalURLServer:
54- self.transport_server = None
55-
56- def create_branches(self):
57- self.build_tree(['base/', 'base/a', 'base/b'])
58- format = controldir.format_registry.make_bzrdir('knit')
59- try:
60- wt_base = controldir.ControlDir.create_standalone_workingtree(
61- self.get_url('base'), format=format)
62- except errors.NotLocalUrl:
63- raise tests.TestSkipped('Not a local URL')
64-
65- b_base = wt_base.branch
66-
67- wt_base.add('a')
68- wt_base.add('b')
69- wt_base.commit('first', rev_id='r@b-1')
70-
71- wt_child = b_base.bzrdir.sprout('child').open_workingtree()
72- self.sftp_base = branch.Branch.open(self.get_url('base'))
73- wt_child.branch.bind(self.sftp_base)
74- # check the branch histories are ready for using in tests.
75- self.assertEqual(['r@b-1'], b_base.revision_history())
76- self.assertEqual(['r@b-1'], wt_child.branch.revision_history())
77- return b_base, wt_child
78-
79- def test_simple_binding(self):
80- self.build_tree(['base/', 'base/a', 'base/b', 'child/'])
81- try:
82- wt_base = controldir.ControlDir.create_standalone_workingtree(
83- self.get_url('base'))
84- except errors.NotLocalUrl:
85- raise tests.TestSkipped('Not a local URL')
86-
87- wt_base.add('a')
88- wt_base.add('b')
89- wt_base.commit('first', rev_id='r@b-1')
90-
91- b_base = wt_base.branch
92- # manually make a branch we can bind, because the default format
93- # may not be bindable-from, and we want to test the side effects etc
94- # of bondage.
95- format = controldir.format_registry.make_bzrdir('knit')
96- b_child = controldir.ControlDir.create_branch_convenience(
97- 'child', format=format)
98- self.assertEqual(None, b_child.get_bound_location())
99- self.assertEqual(None, b_child.get_master_branch())
100-
101- sftp_b_base = branch.Branch.open(self.get_url('base'))
102- b_child.bind(sftp_b_base)
103- self.assertEqual(sftp_b_base.base, b_child.get_bound_location())
104- # the bind must not have given b_child history:
105- self.assertEqual([], b_child.revision_history())
106- # we should be able to update the branch at this point:
107- self.assertEqual(None, b_child.update())
108- # and now there must be history.
109- self.assertEqual(['r@b-1'], b_child.revision_history())
110- # this line is more of a working tree test line, but - what the hey,
111- # it has work to do.
112- b_child.bzrdir.open_workingtree().update()
113- self.assertPathExists('child/a')
114- self.assertPathExists('child/b')
115-
116- b_child.unbind()
117- self.assertEqual(None, b_child.get_bound_location())
118-
119- def test_bound_commit(self):
120- b_base, wt_child = self.create_branches()
121-
122- with open('child/a', 'wb') as f: f.write('new contents\n')
123- wt_child.commit('modified a', rev_id='r@c-2')
124-
125- self.assertEqual(['r@b-1', 'r@c-2'], wt_child.branch.revision_history())
126- self.assertEqual(['r@b-1', 'r@c-2'], b_base.revision_history())
127-
128- def test_bound_commit_fails_when_out_of_date(self):
129- # Make sure commit fails if out of date.
130- b_base, wt_child = self.create_branches()
131-
132- with open('base/a', 'wb') as f: f.write('new base contents\n')
133- b_base.bzrdir.open_workingtree().commit('base', rev_id='r@b-2')
134-
135- with open('child/b', 'wb') as f: f.write('new b child contents\n')
136- self.assertRaises(errors.BoundBranchOutOfDate,
137- wt_child.commit, 'child', rev_id='r@c-2')
138-
139- sftp_b_base = branch.Branch.open(self.get_url('base'))
140-
141- # This is all that cmd_update does
142- wt_child.pull(sftp_b_base, overwrite=False)
143-
144- wt_child.commit('child', rev_id='r@c-3')
145-
146- self.assertEqual(['r@b-1', 'r@b-2', 'r@c-3'],
147- wt_child.branch.revision_history())
148- self.assertEqual(['r@b-1', 'r@b-2', 'r@c-3'],
149- b_base.revision_history())
150- self.assertEqual(['r@b-1', 'r@b-2', 'r@c-3'],
151- sftp_b_base.revision_history())
152-
153- def test_double_binding(self):
154- b_base, wt_child = self.create_branches()
155-
156- wt_child2 = wt_child.branch.create_checkout('child2')
157-
158- with open('child2/a', 'wb') as f: f.write('new contents\n')
159- self.assertRaises(errors.CommitToDoubleBoundBranch,
160- wt_child2.commit, 'child2', rev_id='r@d-2')
161-
162- def test_unbinding(self):
163- b_base, wt_child = self.create_branches()
164-
165- # TestCaseWithSFTPServer only allows you to connect one time
166- # to the SFTP server. So we have to create a connection and
167- # keep it around, so that it can be reused
168- __unused_t = self.get_transport()
169-
170- wt_base = b_base.bzrdir.open_workingtree()
171- with open('base/a', 'wb') as f: f.write('new base contents\n')
172- wt_base.commit('base', rev_id='r@b-2')
173-
174- with open('child/b', 'wb') as f: f.write('new b child contents\n')
175- self.assertRaises(errors.BoundBranchOutOfDate,
176- wt_child.commit, 'child', rev_id='r@c-2')
177- self.assertEqual(['r@b-1'], wt_child.branch.revision_history())
178- wt_child.branch.unbind()
179- wt_child.commit('child', rev_id='r@c-2')
180- self.assertEqual(['r@b-1', 'r@c-2'], wt_child.branch.revision_history())
181- self.assertEqual(['r@b-1', 'r@b-2'], b_base.revision_history())
182-
183- sftp_b_base = branch.Branch.open(self.get_url('base'))
184- self.assertRaises(errors.DivergedBranches,
185- wt_child.branch.bind, sftp_b_base)
186-
187- def test_commit_remote_bound(self):
188- # Make sure it is detected if the current base is bound during the
189- # objects lifetime, when the child goes to commit.
190- b_base, wt_child = self.create_branches()
191-
192- b_base.bzrdir.sprout('newbase')
193-
194- sftp_b_base = branch.Branch.open(self.get_url('base'))
195- sftp_b_newbase = branch.Branch.open(self.get_url('newbase'))
196-
197- sftp_b_base.bind(sftp_b_newbase)
198-
199- with open('child/a', 'wb') as f: f.write('new contents\n')
200- self.assertRaises(errors.CommitToDoubleBoundBranch,
201- wt_child.commit, 'failure', rev_id='r@c-2')
202-
203- self.assertEqual(['r@b-1'], b_base.revision_history())
204- self.assertEqual(['r@b-1'], wt_child.branch.revision_history())
205- self.assertEqual(['r@b-1'], sftp_b_newbase.revision_history())
206-
207- def test_bind_diverged(self):
208- b_base, wt_child = self.create_branches()
209-
210- wt_child.branch.unbind()
211- with open('child/a', 'ab') as f: f.write('child contents\n')
212- wt_child_rev = wt_child.commit('child', rev_id='r@c-2')
213-
214- self.assertEqual(['r@b-1', 'r@c-2'], wt_child.branch.revision_history())
215- self.assertEqual(['r@b-1'], b_base.revision_history())
216-
217- with open('base/b', 'ab') as f: f.write('base contents\n')
218- b_base.bzrdir.open_workingtree().commit('base', rev_id='r@b-2')
219- self.assertEqual(['r@b-1', 'r@b-2'], b_base.revision_history())
220-
221- sftp_b_base = branch.Branch.open(self.get_url('base'))
222-
223- self.assertRaises(errors.DivergedBranches,
224- wt_child.branch.bind, sftp_b_base)
225-
226- wt_child.merge_from_branch(sftp_b_base)
227- self.assertEqual([wt_child_rev, 'r@b-2'], wt_child.get_parent_ids())
228- wt_child.commit('merged', rev_id='r@c-3')
229-
230- # After a merge, trying to bind again should succeed but not push the
231- # new change.
232- wt_child.branch.bind(sftp_b_base)
233-
234- self.assertEqual(['r@b-1', 'r@b-2'], b_base.revision_history())
235- self.assertEqual(['r@b-1', 'r@c-2', 'r@c-3'],
236- wt_child.branch.revision_history())
237-
238- def test_bind_parent_ahead_preserves_parent(self):
239- b_base, wt_child = self.create_branches()
240-
241- wt_child.branch.unbind()
242-
243- with open('a', 'ab') as f: f.write('base changes\n')
244- wt_base = b_base.bzrdir.open_workingtree()
245- wt_base.commit('base', rev_id='r@b-2')
246- self.assertEqual(['r@b-1', 'r@b-2'], b_base.revision_history())
247- self.assertEqual(['r@b-1'], wt_child.branch.revision_history())
248-
249- sftp_b_base = branch.Branch.open(self.get_url('base'))
250- wt_child.branch.bind(sftp_b_base)
251-
252- self.assertEqual(['r@b-1'], wt_child.branch.revision_history())
253-
254- wt_child.branch.unbind()
255-
256- # Check and make sure it also works if parent is ahead multiple
257- wt_base.commit('base 3', rev_id='r@b-3', allow_pointless=True)
258- wt_base.commit('base 4', rev_id='r@b-4', allow_pointless=True)
259- wt_base.commit('base 5', rev_id='r@b-5', allow_pointless=True)
260-
261- self.assertEqual(['r@b-1', 'r@b-2', 'r@b-3', 'r@b-4', 'r@b-5'],
262- b_base.revision_history())
263-
264- self.assertEqual(['r@b-1'], wt_child.branch.revision_history())
265-
266- wt_child.branch.bind(sftp_b_base)
267- self.assertEqual(['r@b-1'], wt_child.branch.revision_history())
268-
269- def test_bind_child_ahead_preserves_child(self):
270- b_base, wt_child = self.create_branches()
271-
272- wt_child.branch.unbind()
273-
274- wt_child.commit('child', rev_id='r@c-2', allow_pointless=True)
275- self.assertEqual(['r@b-1', 'r@c-2'], wt_child.branch.revision_history())
276- self.assertEqual(['r@b-1'], b_base.revision_history())
277-
278- sftp_b_base = branch.Branch.open(self.get_url('base'))
279- wt_child.branch.bind(sftp_b_base)
280-
281- self.assertEqual(['r@b-1'], b_base.revision_history())
282-
283- # Check and make sure it also works if child is ahead multiple
284- wt_child.branch.unbind()
285- wt_child.commit('child 3', rev_id='r@c-3', allow_pointless=True)
286- wt_child.commit('child 4', rev_id='r@c-4', allow_pointless=True)
287- wt_child.commit('child 5', rev_id='r@c-5', allow_pointless=True)
288-
289- self.assertEqual(['r@b-1', 'r@c-2', 'r@c-3', 'r@c-4', 'r@c-5'],
290- wt_child.branch.revision_history())
291- self.assertEqual(['r@b-1'], b_base.revision_history())
292-
293- wt_child.branch.bind(sftp_b_base)
294- self.assertEqual(['r@b-1'], b_base.revision_history())
295-
296- def test_commit_after_merge(self):
297- b_base, wt_child = self.create_branches()
298-
299- # We want merge to be able to be a local only
300- # operation, because it does not alter the branch data.
301-
302- # But we can't fail afterwards
303-
304- wt_other = wt_child.bzrdir.sprout('other').open_workingtree()
305-
306- with open('other/c', 'wb') as f: f.write('file c\n')
307- wt_other.add('c')
308- wt_other.commit('adding c', rev_id='r@d-2')
309-
310- self.assertFalse(wt_child.branch.repository.has_revision('r@d-2'))
311- self.assertFalse(b_base.repository.has_revision('r@d-2'))
312-
313- wt_child.merge_from_branch(wt_other.branch)
314-
315- self.assertPathExists('child/c')
316- self.assertEqual(['r@d-2'], wt_child.get_parent_ids()[1:])
317- self.assertTrue(wt_child.branch.repository.has_revision('r@d-2'))
318- self.assertFalse(b_base.repository.has_revision('r@d-2'))
319-
320- # Commit should succeed, and cause merged revisions to
321- # be pushed into base
322- wt_child.commit('merge other', rev_id='r@c-2')
323- self.assertEqual(['r@b-1', 'r@c-2'], wt_child.branch.revision_history())
324- self.assertEqual(['r@b-1', 'r@c-2'], b_base.revision_history())
325- self.assertTrue(b_base.repository.has_revision('r@d-2'))
326-
327- def test_commit_fails(self):
328- b_base, wt_child = self.create_branches()
329-
330- with open('a', 'ab') as f: f.write('child adds some text\n')
331-
332- # this deletes the branch from memory
333- del b_base
334- # and this moves it out of the way on disk
335- os.rename('base', 'hidden_base')
336-
337- self.assertRaises(errors.BoundBranchConnectionFailure,
338- wt_child.commit, 'added text', rev_id='r@c-2')
339-
340- # TODO: jam 20051231 We need invasive failure tests, so that we can show
341- # performance even when something fails.
342-
343-