Merge lp:~mbp/bzr/externalbase into lp:bzr

Proposed by Martin Pool
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 5309
Proposed branch: lp:~mbp/bzr/externalbase
Merge into: lp:bzr
Prerequisite: lp:~mbp/bzr/scripts
Diff against target: 1076 lines (+237/-186) (has conflicts)
34 files modified
NEWS (+5/-0)
bzrlib/tests/blackbox/__init__.py (+7/-1)
bzrlib/tests/blackbox/test_added.py (+4/-4)
bzrlib/tests/blackbox/test_alias.py (+2/-2)
bzrlib/tests/blackbox/test_aliases.py (+2/-2)
bzrlib/tests/blackbox/test_branch.py (+4/-4)
bzrlib/tests/blackbox/test_break_lock.py (+5/-5)
bzrlib/tests/blackbox/test_cat_revision.py (+12/-15)
bzrlib/tests/blackbox/test_check.py (+4/-4)
bzrlib/tests/blackbox/test_checkout.py (+3/-3)
bzrlib/tests/blackbox/test_commit.py (+4/-4)
bzrlib/tests/blackbox/test_deleted.py (+4/-4)
bzrlib/tests/blackbox/test_dpush.py (+22/-10)
bzrlib/tests/blackbox/test_export.py (+4/-4)
bzrlib/tests/blackbox/test_filesystem_cicp.py (+94/-72)
bzrlib/tests/blackbox/test_find_merge_base.py (+4/-4)
bzrlib/tests/blackbox/test_help.py (+2/-2)
bzrlib/tests/blackbox/test_ignore.py (+2/-2)
bzrlib/tests/blackbox/test_ignored.py (+4/-4)
bzrlib/tests/blackbox/test_init.py (+3/-3)
bzrlib/tests/blackbox/test_modified.py (+2/-2)
bzrlib/tests/blackbox/test_nick.py (+4/-4)
bzrlib/tests/blackbox/test_pull.py (+2/-2)
bzrlib/tests/blackbox/test_push.py (+1/-1)
bzrlib/tests/blackbox/test_remerge.py (+2/-2)
bzrlib/tests/blackbox/test_remove.py (+2/-2)
bzrlib/tests/blackbox/test_remove_tree.py (+4/-4)
bzrlib/tests/blackbox/test_revert.py (+2/-2)
bzrlib/tests/blackbox/test_revision_info.py (+6/-6)
bzrlib/tests/blackbox/test_rmbranch.py (+3/-3)
bzrlib/tests/blackbox/test_switch.py (+2/-2)
bzrlib/tests/blackbox/test_too_much.py (+3/-3)
bzrlib/tests/blackbox/test_unknowns.py (+4/-4)
bzrlib/tests/blackbox/test_whoami.py (+9/-0)
Text conflict in NEWS
Text conflict in bzrlib/tests/blackbox/test_whoami.py
To merge this branch: bzr merge lp:~mbp/bzr/externalbase
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+27583@code.launchpad.net

Commit message

Change from ExternalBase to scripts, and deprecate it.

Description of the change

We have a separate base class ExternalBase for blackbox tests, but it's really just noise at this point because it adds no new facilities beyond the base test classes, and the blackbox commands aren't even run in an external process (which was the original meaning of the name).

 * deprecate ExternalBase.check_output
 * change subclasses to TestCaseWithTransport
 * change most tests that used it to run_script, which is IMO more readable and less likely to accidentally not check something (and should be no slower)

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

Yeah ! I was stealth-ly working toward the same goal :)

Since you're there, how about replacing 'from bzrlib.tests import TestCaseWithTransport ... (TestCaseWithTransport)' by 'from bzrlib import tests.... (tests.TestCaseWithTransport)' ? :-p

953 - def check_error(self, output, *args):
954 - """Verify that the expected error matches what bzr says.
955 + def check_output(self, output, *args):
956 + """Verify that the expected output matches what bzr says.
957
958 The output is supplied first, so that you can supply a variable
959 number of arguments to bzr.
960 """
961 - self.assertContainsRe(self.run_bzr(args, retcode=3)[1], output)
962 + self.assertEquals(self.run_bzr(*args)[0], output)

Really ? I'm surprised that changing a method name doesn't come with corresponding changes in the tests themselves... This sounds like an intermediate step that you left behind when switching to run_script().

Is it still needed ?

Overall, nice demo of script usefulness... thanks :)

My vote is 'Tweak' make sure you land https://code.edge.launchpad.net/~mbp/bzr/scripts/+merge/27581 first or get rid of it.

review: Needs Fixing
Revision history for this message
Martin Pool (mbp) wrote :

On 15 June 2010 18:13, Vincent Ladeuil <email address hidden> wrote:
> Review: Needs Fixing
> Yeah ! I was stealth-ly working toward the same goal :)
>
> Since you're there, how about replacing 'from bzrlib.tests import TestCaseWithTransport ... (TestCaseWithTransport)' by 'from bzrlib import tests.... (tests.TestCaseWithTransport)' ? :-p
>
> 953     - def check_error(self, output, *args):
> 954     - """Verify that the expected error matches what bzr says.
> 955     + def check_output(self, output, *args):
> 956     + """Verify that the expected output matches what bzr says.
> 957
> 958     The output is supplied first, so that you can supply a variable
> 959     number of arguments to bzr.
> 960     """
> 961     - self.assertContainsRe(self.run_bzr(args, retcode=3)[1], output)
> 962     + self.assertEquals(self.run_bzr(*args)[0], output)
>

> Really ? I'm surprised that changing a method name doesn't come with corresponding changes in the tests
themselves... This sounds like an intermediate step that you left
behind when switching to run_script().

Actually this is just a strange diff hunk. test_revision_info
declared a check_error but didn't use it. They did use check_output
from ExternalBase, and weren't particularly suitable for changing to
scripts. So for now I just gave them a check_output of their own.
This is a bit of a sideways step for code cleanliness, but I think
this patch is worthwhile overall, and we could clean
test_revision_info more later.
--
Martin

Revision history for this message
Vincent Ladeuil (vila) wrote :

> I think this patch is worthwhile overall, and we could clean
> test_revision_info more later.

Yup, that's why I voted tweak, I'm ok to land this.

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

This:

195 - self.check_output(revs[1], 'cat-revision a@r-0-1')
196 - self.check_output(revs[2], 'cat-revision a@r-0-2')
197 - self.check_output(revs[3], 'cat-revision a@r-0-3')
198 -
199 - self.check_output(revs[1], 'cat-revision -r 1')
200 - self.check_output(revs[2], 'cat-revision -r 2')
201 - self.check_output(revs[3], 'cat-revision -r 3')
202 -
203 - self.check_output(revs[1], 'cat-revision -r revid:a@r-0-1')
204 - self.check_output(revs[2], 'cat-revision -r revid:a@r-0-2')
205 - self.check_output(revs[3], 'cat-revision -r revid:a@r-0-3')
206 + for i in [1, 2, 3]:
207 + self.assertEqual(revs[i],
208 + self.run_bzr('cat-revision -r revid:a@r-0-%d' % i)[0])
209 + self.assertEqual(revs[i],
210 + self.run_bzr('cat-revision a@r-0-%d' % i)[0])
211 + self.assertEqual(revs[i],
212 + self.run_bzr('cat-revision -r %d' % i)[0])

Results in harder to evaluate exceptions. I realise its very unlikely to fail but if it does you'll get something like
'serialised_revision' != 'other serialized revision'

and no evidence of *what* revision id we were actually asking for.

I'm going to land this as this code is pretty unlikely to change, but I think we should generally avoid such for loops vigorously: use parameterisation instead, or explicit lists as the test had before.

Revision history for this message
Martin Pool (mbp) wrote :

On 21 June 2010 07:25, Robert Collins <email address hidden> wrote:
> This:
>
> 195     -        self.check_output(revs[1], 'cat-revision a@r-0-1')
> 196     -        self.check_output(revs[2], 'cat-revision a@r-0-2')
> 197     -        self.check_output(revs[3], 'cat-revision a@r-0-3')
> 198     -
> 199     -        self.check_output(revs[1], 'cat-revision -r 1')
> 200     -        self.check_output(revs[2], 'cat-revision -r 2')
> 201     -        self.check_output(revs[3], 'cat-revision -r 3')
> 202     -
> 203     -        self.check_output(revs[1], 'cat-revision -r revid:a@r-0-1')
> 204     -        self.check_output(revs[2], 'cat-revision -r revid:a@r-0-2')
> 205     -        self.check_output(revs[3], 'cat-revision -r revid:a@r-0-3')
> 206     +        for i in [1, 2, 3]:
> 207     +            self.assertEqual(revs[i],
> 208     +                self.run_bzr('cat-revision -r revid:a@r-0-%d' % i)[0])
> 209     +            self.assertEqual(revs[i],
> 210     +                self.run_bzr('cat-revision a@r-0-%d' % i)[0])
> 211     +            self.assertEqual(revs[i],
> 212     +                self.run_bzr('cat-revision -r %d' % i)[0])
>
> Results in harder to evaluate exceptions. I realise its very unlikely to fail but if it does you'll get something like
> 'serialised_revision' != 'other serialized revision'
>
> and no evidence of *what* revision id we were actually asking for.
>
> I'm going to land this as this code is pretty unlikely to change, but I think we should generally avoid such for loops vigorously: use parameterisation instead, or explicit lists as the test had before.

I think the exception from run_bzr tells you what command it's
running, so that should make it quite clear what failed. If your test
framework tells you "manually unroll loops by copy&paste" then the
framework is buggy. :-)

--
Martin

Revision history for this message
Robert Collins (lifeless) wrote :

I agree that the test framework is buggy :) - I did say that using parameterisation would be better, I think. Anyhow, its all moot - it was landed as is .

Revision history for this message
Martin Pool (mbp) wrote :

On 22 June 2010 09:30, Robert Collins <email address hidden> wrote:
> I agree that the test framework is buggy :) - I did say that using parameterisation would be better, I think. Anyhow, its all moot - it was landed as is .

It's not really obvious to me how you would parameterize this. What
would you do?

If I wanted to get rid of the for loop I'd probably delete all but one
case, because they're not really covering anything different. But for
a cleanup I wanted to make a smaller change.

--
Martin

Revision history for this message
Robert Collins (lifeless) wrote :

On Tue, Jun 22, 2010 at 1:22 PM, Martin Pool <email address hidden> wrote:
> On 22 June 2010 09:30, Robert Collins <email address hidden> wrote:
>> I agree that the test framework is buggy :) - I did say that using parameterisation would be better, I think. Anyhow, its all moot - it was landed as is .
>
> It's not really obvious to me how you would parameterize this.  What
> would you do?

Make a scenario per revid I wanted to test with, and seperately a
scenario for testing that 1 rev in N is accessible, and possibly cross
multiply them.

-Rob

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-06-15 06:35:40 +0000
3+++ NEWS 2010-06-15 06:35:41 +0000
4@@ -103,6 +103,11 @@
5 ``bzrlib.patiencediff`` instead.
6 (Andrew Bennetts)
7
8+* ``bzrlib.tests.blackbox.ExternalBase`` is deprecated. It provided only
9+ one method ``check_output``, and we now recommend checking command
10+ output using ``run_script``.
11+ (Martin Pool)
12+
13 Internals
14 *********
15
16
17=== modified file 'bzrlib/tests/blackbox/__init__.py'
18--- bzrlib/tests/blackbox/__init__.py 2010-05-03 09:19:15 +0000
19+++ bzrlib/tests/blackbox/__init__.py 2010-06-15 06:35:41 +0000
20@@ -1,4 +1,4 @@
21-# Copyright (C) 2005-2010 Canonical Ltd
22+# Copyright (C) 2005, 2006, 2007, 2010 Canonical Ltd
23 #
24 # This program is free software; you can redistribute it and/or modify
25 # it under the terms of the GNU General Public License as published by
26@@ -23,6 +23,10 @@
27 """
28
29
30+from bzrlib.symbol_versioning import (
31+ deprecated_in,
32+ deprecated_method,
33+ )
34 from bzrlib import tests
35
36
37@@ -126,7 +130,9 @@
38
39
40 class ExternalBase(tests.TestCaseWithTransport):
41+ """Don't use this class anymore, use TestCaseWithTransport or similar"""
42
43+ @deprecated_method(deprecated_in((2, 2, 0)))
44 def check_output(self, output, *args):
45 """Verify that the expected output matches what bzr says.
46
47
48=== modified file 'bzrlib/tests/blackbox/test_added.py'
49--- bzrlib/tests/blackbox/test_added.py 2010-05-02 20:10:25 +0000
50+++ bzrlib/tests/blackbox/test_added.py 2010-06-15 06:35:41 +0000
51@@ -21,10 +21,10 @@
52 import os
53
54 from bzrlib.branch import Branch
55-from bzrlib.tests.blackbox import ExternalBase
56-
57-
58-class TestAdded(ExternalBase):
59+from bzrlib.tests import TestCaseWithTransport
60+
61+
62+class TestAdded(TestCaseWithTransport):
63
64 def test_added(self):
65 """Test that 'added' command reports added files"""
66
67=== modified file 'bzrlib/tests/blackbox/test_alias.py'
68--- bzrlib/tests/blackbox/test_alias.py 2010-04-29 03:23:18 +0000
69+++ bzrlib/tests/blackbox/test_alias.py 2010-06-15 06:35:41 +0000
70@@ -19,11 +19,11 @@
71 import os
72 import codecs
73
74-from bzrlib.tests.blackbox import ExternalBase
75+from bzrlib.tests import TestCaseWithTransport
76 from bzrlib.config import (ensure_config_dir_exists, config_filename)
77
78
79-class TestAlias(ExternalBase):
80+class TestAlias(TestCaseWithTransport):
81
82 def test_list_alias_with_none(self):
83 """Calling alias with no parameters lists existing aliases."""
84
85=== modified file 'bzrlib/tests/blackbox/test_aliases.py'
86--- bzrlib/tests/blackbox/test_aliases.py 2009-03-23 14:59:43 +0000
87+++ bzrlib/tests/blackbox/test_aliases.py 2010-06-15 06:35:41 +0000
88@@ -19,12 +19,12 @@
89 import os
90
91 from bzrlib.branch import Branch
92-from bzrlib.tests.blackbox import ExternalBase
93+from bzrlib.tests import TestCaseWithTransport
94 from bzrlib.trace import mutter
95 from bzrlib.config import (ensure_config_dir_exists, config_filename)
96
97
98-class TestAliases(ExternalBase):
99+class TestAliases(TestCaseWithTransport):
100
101 def test_aliases(self):
102
103
104=== modified file 'bzrlib/tests/blackbox/test_branch.py'
105--- bzrlib/tests/blackbox/test_branch.py 2010-04-22 17:08:27 +0000
106+++ bzrlib/tests/blackbox/test_branch.py 2010-06-15 06:35:41 +0000
107@@ -27,7 +27,7 @@
108 revision as _mod_revision,
109 )
110 from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
111-from bzrlib.tests.blackbox import ExternalBase
112+from bzrlib.tests import TestCaseWithTransport
113 from bzrlib.tests import (
114 KnownFailure,
115 HardlinkFeature,
116@@ -38,7 +38,7 @@
117 from bzrlib.workingtree import WorkingTree
118
119
120-class TestBranch(ExternalBase):
121+class TestBranch(TestCaseWithTransport):
122
123 def example_branch(self, path='.'):
124 tree = self.make_branch_and_tree(path)
125@@ -248,7 +248,7 @@
126 self.assertLength(2, calls)
127
128
129-class TestBranchStacked(ExternalBase):
130+class TestBranchStacked(TestCaseWithTransport):
131 """Tests for branch --stacked"""
132
133 def assertRevisionInRepository(self, repo_path, revid):
134@@ -376,7 +376,7 @@
135 err)
136
137
138-class TestSmartServerBranching(ExternalBase):
139+class TestSmartServerBranching(TestCaseWithTransport):
140
141 def test_branch_from_trivial_branch_to_same_server_branch_acceptance(self):
142 self.setup_smart_server_with_call_log()
143
144=== modified file 'bzrlib/tests/blackbox/test_break_lock.py'
145--- bzrlib/tests/blackbox/test_break_lock.py 2010-03-25 09:39:03 +0000
146+++ bzrlib/tests/blackbox/test_break_lock.py 2010-06-15 06:35:41 +0000
147@@ -25,10 +25,10 @@
148 )
149 from bzrlib.branch import Branch
150 from bzrlib.bzrdir import BzrDir
151-from bzrlib.tests.blackbox import ExternalBase
152-
153-
154-class TestBreakLock(ExternalBase):
155+from bzrlib.tests import TestCaseWithTransport
156+
157+
158+class TestBreakLock(TestCaseWithTransport):
159
160 # General principal for break-lock: All the elements that might be locked
161 # by a bzr operation on PATH, are candidates that break-lock may unlock.
162@@ -93,7 +93,7 @@
163 self.assertRaises(errors.LockBroken, self.master_branch.unlock)
164
165
166-class TestBreakLockOldBranch(ExternalBase):
167+class TestBreakLockOldBranch(TestCaseWithTransport):
168
169 def test_break_lock_format_5_bzrdir(self):
170 # break lock on a format 5 bzrdir should just return
171
172=== modified file 'bzrlib/tests/blackbox/test_cat_revision.py'
173--- bzrlib/tests/blackbox/test_cat_revision.py 2010-05-02 20:10:25 +0000
174+++ bzrlib/tests/blackbox/test_cat_revision.py 2010-06-15 06:35:41 +0000
175@@ -14,10 +14,11 @@
176 # along with this program; if not, write to the Free Software
177 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
178
179-from bzrlib.tests import blackbox
180-
181-
182-class TestCatRevision(blackbox.ExternalBase):
183+
184+from bzrlib.tests import TestCaseWithTransport
185+
186+
187+class TestCatRevision(TestCaseWithTransport):
188
189 def test_cat_unicode_revision(self):
190 tree = self.make_branch_and_tree('.')
191@@ -47,17 +48,13 @@
192 finally:
193 r.unlock()
194
195- self.check_output(revs[1], 'cat-revision a@r-0-1')
196- self.check_output(revs[2], 'cat-revision a@r-0-2')
197- self.check_output(revs[3], 'cat-revision a@r-0-3')
198-
199- self.check_output(revs[1], 'cat-revision -r 1')
200- self.check_output(revs[2], 'cat-revision -r 2')
201- self.check_output(revs[3], 'cat-revision -r 3')
202-
203- self.check_output(revs[1], 'cat-revision -r revid:a@r-0-1')
204- self.check_output(revs[2], 'cat-revision -r revid:a@r-0-2')
205- self.check_output(revs[3], 'cat-revision -r revid:a@r-0-3')
206+ for i in [1, 2, 3]:
207+ self.assertEqual(revs[i],
208+ self.run_bzr('cat-revision -r revid:a@r-0-%d' % i)[0])
209+ self.assertEqual(revs[i],
210+ self.run_bzr('cat-revision a@r-0-%d' % i)[0])
211+ self.assertEqual(revs[i],
212+ self.run_bzr('cat-revision -r %d' % i)[0])
213
214 def test_cat_no_such_revid(self):
215 tree = self.make_branch_and_tree('.')
216
217=== modified file 'bzrlib/tests/blackbox/test_check.py'
218--- bzrlib/tests/blackbox/test_check.py 2009-08-04 04:36:34 +0000
219+++ bzrlib/tests/blackbox/test_check.py 2010-06-15 06:35:41 +0000
220@@ -17,10 +17,10 @@
221 """Tests for the 'check' CLI command."""
222
223 from bzrlib.tests import ChrootedTestCase
224-from bzrlib.tests.blackbox import ExternalBase
225-
226-
227-class TestCheck(ExternalBase):
228+from bzrlib.tests import TestCaseWithTransport
229+
230+
231+class TestCheck(TestCaseWithTransport):
232
233 def test_check_no_tree(self):
234 self.make_branch('.')
235
236=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
237--- bzrlib/tests/blackbox/test_checkout.py 2010-05-12 12:55:04 +0000
238+++ bzrlib/tests/blackbox/test_checkout.py 2010-06-15 06:35:41 +0000
239@@ -28,8 +28,8 @@
240 errors,
241 workingtree,
242 )
243-from bzrlib.tests.blackbox import (
244- ExternalBase,
245+from bzrlib.tests import (
246+ TestCaseWithTransport,
247 )
248 from bzrlib.tests import (
249 HardlinkFeature,
250@@ -37,7 +37,7 @@
251 )
252
253
254-class TestCheckout(ExternalBase):
255+class TestCheckout(TestCaseWithTransport):
256
257 def setUp(self):
258 super(TestCheckout, self).setUp()
259
260=== modified file 'bzrlib/tests/blackbox/test_commit.py'
261--- bzrlib/tests/blackbox/test_commit.py 2010-05-20 18:23:17 +0000
262+++ bzrlib/tests/blackbox/test_commit.py 2010-06-15 06:35:41 +0000
263@@ -33,10 +33,10 @@
264 probe_bad_non_ascii,
265 TestSkipped,
266 )
267-from bzrlib.tests.blackbox import ExternalBase
268-
269-
270-class TestCommit(ExternalBase):
271+from bzrlib.tests import TestCaseWithTransport
272+
273+
274+class TestCommit(TestCaseWithTransport):
275
276 def test_05_empty_commit(self):
277 """Commit of tree with no versioned files should fail"""
278
279=== modified file 'bzrlib/tests/blackbox/test_deleted.py'
280--- bzrlib/tests/blackbox/test_deleted.py 2010-05-02 20:10:25 +0000
281+++ bzrlib/tests/blackbox/test_deleted.py 2010-06-15 06:35:41 +0000
282@@ -21,10 +21,10 @@
283 import os
284
285 from bzrlib.branch import Branch
286-from bzrlib.tests.blackbox import ExternalBase
287-
288-
289-class TestDeleted(ExternalBase):
290+from bzrlib.tests import TestCaseWithTransport
291+
292+
293+class TestDeleted(TestCaseWithTransport):
294
295 def test_deleted_directory(self):
296 """Test --directory option"""
297
298=== modified file 'bzrlib/tests/blackbox/test_dpush.py'
299--- bzrlib/tests/blackbox/test_dpush.py 2010-04-28 10:30:48 +0000
300+++ bzrlib/tests/blackbox/test_dpush.py 2010-06-15 06:35:41 +0000
301@@ -1,4 +1,4 @@
302-# Copyright (C) 2009, 2010 Canonical Ltd
303+# Copyright (C) 2005, 2007, 2008, 2009, 2010 Canonical Ltd
304 #
305 # This program is free software; you can redistribute it and/or modify
306 # it under the terms of the GNU General Public License as published by
307@@ -29,6 +29,7 @@
308 )
309 from bzrlib.tests import (
310 blackbox,
311+ script,
312 test_foreign,
313 )
314 from bzrlib.tests.blackbox import test_push
315@@ -58,7 +59,7 @@
316 return result
317
318
319-class TestDpush(blackbox.ExternalBase):
320+class TestDpush(tests.TestCaseWithTransport):
321
322 def setUp(self):
323 super(TestDpush, self).setUp()
324@@ -86,9 +87,11 @@
325 self.build_tree(("dc/foo", "blaaaa"))
326 dc.open_workingtree().commit('msg')
327
328- output, error = self.run_bzr("dpush -d dc d")
329- self.assertEquals(error, "Pushed up to revision 2.\n")
330- self.check_output("", "status dc")
331+ script.run_script(self, """
332+ $ bzr dpush -d dc d
333+ 2>Pushed up to revision 2.
334+ $ bzr status dc
335+ """)
336
337 def test_dpush_new(self):
338 b = self.make_dummy_builder('d').get_branch()
339@@ -99,9 +102,12 @@
340 dc_tree.add("foofile")
341 dc_tree.commit("msg")
342
343- self.check_output("", "dpush -d dc d")
344- self.check_output("2\n", "revno dc")
345- self.check_output("", "status dc")
346+ script.run_script(self, '''
347+ $ bzr dpush -d dc d
348+ $ bzr revno dc
349+ 2
350+ $ bzr status dc
351+ ''')
352
353 def test_dpush_wt_diff(self):
354 b = self.make_dummy_builder('d').get_branch()
355@@ -113,11 +119,17 @@
356 newrevid = dc_tree.commit('msg')
357
358 self.build_tree_contents([("dc/foofile", "blaaaal")])
359- self.check_output("", "dpush -d dc d --no-strict")
360+ script.run_script(self, '''
361+ $ bzr dpush -d dc d --no-strict
362+ ''')
363 self.assertFileEqual("blaaaal", "dc/foofile")
364 # if the dummy vcs wasn't that dummy we could uncomment the line below
365 # self.assertFileEqual("blaaaa", "d/foofile")
366- self.check_output('modified:\n foofile\n', "status dc")
367+ script.run_script(self, '''
368+ $ bzr status dc
369+ modified:
370+ foofile
371+ ''')
372
373 def test_diverged(self):
374 builder = self.make_dummy_builder('d')
375
376=== modified file 'bzrlib/tests/blackbox/test_export.py'
377--- bzrlib/tests/blackbox/test_export.py 2010-05-02 20:10:25 +0000
378+++ bzrlib/tests/blackbox/test_export.py 2010-06-15 06:35:41 +0000
379@@ -30,10 +30,10 @@
380 export,
381 tests,
382 )
383-from bzrlib.tests.blackbox import ExternalBase
384-
385-
386-class TestExport(ExternalBase):
387+from bzrlib.tests import TestCaseWithTransport
388+
389+
390+class TestExport(TestCaseWithTransport):
391
392 def test_tar_export(self):
393 tree = self.make_branch_and_tree('tar')
394
395=== modified file 'bzrlib/tests/blackbox/test_filesystem_cicp.py'
396--- bzrlib/tests/blackbox/test_filesystem_cicp.py 2010-04-28 07:53:34 +0000
397+++ bzrlib/tests/blackbox/test_filesystem_cicp.py 2010-06-15 06:35:41 +0000
398@@ -19,13 +19,16 @@
399
400 import os
401
402-from bzrlib import (osutils,
403+from bzrlib import (
404+ osutils,
405+ tests,
406 )
407-from bzrlib.tests.blackbox import ExternalBase
408 from bzrlib.tests import CaseInsCasePresFilenameFeature, KnownFailure
409 from bzrlib.osutils import canonical_relpath, pathjoin
410-
411-class TestCICPBase(ExternalBase):
412+from bzrlib.tests.script import run_script
413+
414+
415+class TestCICPBase(tests.TestCaseWithTransport):
416 """Base class for tests on a case-insensitive, case-preserving filesystem.
417 """
418
419@@ -42,16 +45,6 @@
420 ])
421 return wt
422
423- def check_error_output(self, retcode, output, *args):
424- got = self.run_bzr(retcode=retcode, *args)[1]
425- self.failUnlessEqual(got, output)
426-
427- def check_empty_output(self, *args):
428- """Check a bzr command generates no output anywhere and exits with 0"""
429- out, err = self.run_bzr(retcode=0, *args)
430- self.failIf(out)
431- self.failIf(err)
432-
433
434 class TestAdd(TestCICPBase):
435
436@@ -60,28 +53,32 @@
437 wt = self.make_branch_and_tree('.')
438 # create a file on disk with the mixed-case name
439 self.build_tree(['CamelCase'])
440-
441- self.check_output('adding CamelCase\n', 'add camelcase')
442+ run_script(self, """
443+ $ bzr add camelcase
444+ adding CamelCase
445+ """)
446
447 def test_add_subdir(self):
448 """test_add_simple but with subdirectories tested too."""
449 wt = self.make_branch_and_tree('.')
450 # create a file on disk with the mixed-case parent and base name
451 self.build_tree(['CamelCaseParent/', 'CamelCaseParent/CamelCase'])
452-
453- self.check_output('adding CamelCaseParent\n'
454- 'adding CamelCaseParent/CamelCase\n',
455- 'add camelcaseparent/camelcase')
456+ run_script(self, """
457+ $ bzr add camelcaseparent/camelcase
458+ adding CamelCaseParent
459+ adding CamelCaseParent/CamelCase
460+ """)
461
462 def test_add_implied(self):
463 """test add with no args sees the correct names."""
464 wt = self.make_branch_and_tree('.')
465 # create a file on disk with the mixed-case parent and base name
466 self.build_tree(['CamelCaseParent/', 'CamelCaseParent/CamelCase'])
467-
468- self.check_output('adding CamelCaseParent\n'
469- 'adding CamelCaseParent/CamelCase\n',
470- 'add')
471+ run_script(self, """
472+ $ bzr add
473+ adding CamelCaseParent
474+ adding CamelCaseParent/CamelCase
475+ """)
476
477 def test_re_add(self):
478 """Test than when a file has 'unintentionally' changed case, we can't
479@@ -89,10 +86,15 @@
480 wt = self.make_branch_and_tree('.')
481 # create a file on disk with the mixed-case name
482 self.build_tree(['MixedCase'])
483- self.check_output('adding MixedCase\n', 'add MixedCase')
484+ run_script(self, """
485+ $ bzr add MixedCase
486+ adding MixedCase
487+ """)
488 # 'accidently' rename the file on disk
489 osutils.rename('MixedCase', 'mixedcase')
490- self.check_empty_output('add mixedcase')
491+ run_script(self, """
492+ $ bzr add mixedcase
493+ """)
494
495 def test_re_add_dir(self):
496 # like re-add, but tests when the operation is on a directory.
497@@ -101,12 +103,16 @@
498 wt = self.make_branch_and_tree('.')
499 # create a file on disk with the mixed-case name
500 self.build_tree(['MixedCaseParent/', 'MixedCaseParent/MixedCase'])
501- self.check_output('adding MixedCaseParent\n'
502- 'adding MixedCaseParent/MixedCase\n',
503- 'add MixedCaseParent')
504+ run_script(self, """
505+ $ bzr add MixedCaseParent
506+ adding MixedCaseParent
507+ adding MixedCaseParent/MixedCase
508+ """)
509 # 'accidently' rename the directory on disk
510 osutils.rename('MixedCaseParent', 'mixedcaseparent')
511- self.check_empty_output('add mixedcaseparent')
512+ run_script(self, """
513+ $ bzr add mixedcaseparent
514+ """)
515
516 def test_add_not_found(self):
517 """Test add when the input file doesn't exist."""
518@@ -114,31 +120,34 @@
519 # create a file on disk with the mixed-case name
520 self.build_tree(['MixedCaseParent/', 'MixedCaseParent/MixedCase'])
521 expected_fname = pathjoin(wt.basedir, "MixedCaseParent", "notfound")
522- expected_msg = "bzr: ERROR: No such file: %r\n" % expected_fname
523- self.check_error_output(3, expected_msg, 'add mixedcaseparent/notfound')
524+ run_script(self, """
525+ $ bzr add mixedcaseparent/notfound
526+ 2>bzr: ERROR: No such file: %s
527+ """ % (repr(expected_fname),))
528
529
530 class TestMove(TestCICPBase):
531+
532 def test_mv_newname(self):
533 wt = self._make_mixed_case_tree()
534- self.run_bzr('add')
535- self.run_bzr('ci -m message')
536-
537- self.check_output(
538- 'CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase\n',
539- 'mv camelcaseparent/camelcase camelcaseparent/NewCamelCase')
540+ run_script(self, """
541+ $ bzr add
542+ $ bzr ci -m message
543+ $ bzr mv camelcaseparent/camelcase camelcaseparent/NewCamelCase
544+ CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase
545+ """)
546
547 def test_mv_newname_after(self):
548 wt = self._make_mixed_case_tree()
549- self.run_bzr('add')
550- self.run_bzr('ci -m message')
551- osutils.rename('CamelCaseParent/CamelCase', 'CamelCaseParent/NewCamelCase')
552-
553 # In this case we can specify the incorrect case for the destination,
554 # as we use --after, so the file-system is sniffed.
555- self.check_output(
556- 'CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase\n',
557- 'mv --after camelcaseparent/camelcase camelcaseparent/newcamelcase')
558+ run_script(self, """
559+ $ bzr add
560+ $ bzr ci -m message
561+ $ mv CamelCaseParent/CamelCase CamelCaseParent/NewCamelCase
562+ $ bzr mv --after camelcaseparent/camelcase camelcaseparent/newcamelcase
563+ CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase
564+ """)
565
566 def test_mv_newname_exists(self):
567 # test a mv, but when the target already exists with a name that
568@@ -146,8 +155,11 @@
569 wt = self._make_mixed_case_tree()
570 self.run_bzr('add')
571 self.run_bzr('ci -m message')
572- ex = 'bzr: ERROR: Could not move CamelCase => lowercase: lowercaseparent/lowercase is already versioned.\n'
573- self.check_error_output(3, ex, 'mv camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE')
574+ run_script(self, """
575+ $ bzr mv camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE
576+ 2>bzr: ERROR: Could not move CamelCase => lowercase: \
577+lowercaseparent/lowercase is already versioned.
578+ """)
579
580 def test_mv_newname_exists_after(self):
581 # test a 'mv --after', but when the target already exists with a name
582@@ -160,27 +172,32 @@
583 # bzr should report that the filename is already versioned.
584 os.unlink('CamelCaseParent/CamelCase')
585 osutils.rename('lowercaseparent/lowercase', 'lowercaseparent/LOWERCASE')
586- ex = 'bzr: ERROR: Could not move CamelCase => lowercase: lowercaseparent/lowercase is already versioned.\n'
587- self.check_error_output(3, ex, 'mv --after camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE')
588+ run_script(self, """
589+ $ bzr mv --after camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE
590+ 2>bzr: ERROR: Could not move CamelCase => lowercase: \
591+lowercaseparent/lowercase is already versioned.
592+ """)
593
594 def test_mv_newname_root(self):
595 wt = self._make_mixed_case_tree()
596 self.run_bzr('add')
597 self.run_bzr('ci -m message')
598-
599- self.check_output('CamelCaseParent => NewCamelCaseParent\n',
600- 'mv camelcaseparent NewCamelCaseParent')
601+ run_script(self, """
602+ $ bzr mv camelcaseparent NewCamelCaseParent
603+ CamelCaseParent => NewCamelCaseParent
604+ """)
605
606 def test_mv_newname_root_after(self):
607 wt = self._make_mixed_case_tree()
608 self.run_bzr('add')
609 self.run_bzr('ci -m message')
610- osutils.rename('CamelCaseParent', 'NewCamelCaseParent')
611-
612 # In this case we can specify the incorrect case for the destination,
613 # as we use --after, so the file-system is sniffed.
614- self.check_output('CamelCaseParent => NewCamelCaseParent\n',
615- 'mv --after camelcaseparent newcamelcaseparent')
616+ run_script(self, """
617+ $ mv CamelCaseParent NewCamelCaseParent
618+ $ bzr mv --after camelcaseparent NewCamelCaseParent
619+ CamelCaseParent => NewCamelCaseParent
620+ """)
621
622 def test_mv_newcase(self):
623 wt = self._make_mixed_case_tree()
624@@ -189,8 +206,10 @@
625
626 # perform a mv to the new case - we expect bzr to accept the new
627 # name, as specified, and rename the file on the file-system too.
628- self.check_output('CamelCaseParent/CamelCase => CamelCaseParent/camelCase\n',
629- 'mv camelcaseparent/camelcase camelcaseparent/camelCase')
630+ run_script(self, """
631+ $ bzr mv camelcaseparent/camelcase camelcaseparent/camelCase
632+ CamelCaseParent/CamelCase => CamelCaseParent/camelCase
633+ """)
634 self.failUnlessEqual(canonical_relpath(wt.basedir, 'camelcaseparent/camelcase'),
635 'CamelCaseParent/camelCase')
636
637@@ -202,8 +221,10 @@
638 # perform a mv to the new case - we must ensure the file-system has the
639 # new case first.
640 osutils.rename('CamelCaseParent/CamelCase', 'CamelCaseParent/camelCase')
641- self.check_output('CamelCaseParent/CamelCase => CamelCaseParent/camelCase\n',
642- 'mv --after camelcaseparent/camelcase camelcaseparent/camelCase')
643+ run_script(self, """
644+ $ bzr mv --after camelcaseparent/camelcase camelcaseparent/camelCase
645+ CamelCaseParent/CamelCase => CamelCaseParent/camelCase
646+ """)
647 # bzr should not have renamed the file to a different case
648 self.failUnlessEqual(canonical_relpath(wt.basedir, 'camelcaseparent/camelcase'),
649 'CamelCaseParent/camelCase')
650@@ -212,9 +233,11 @@
651 wt = self._make_mixed_case_tree()
652 self.run_bzr('add')
653 self.run_bzr('ci -m message')
654- self.check_output('lowercaseparent/lowercase => CamelCaseParent/lowercase\n'
655- 'lowercaseparent/mixedCase => CamelCaseParent/mixedCase\n',
656- 'mv LOWercaseparent/LOWercase LOWercaseparent/MIXEDCase camelcaseparent')
657+ run_script(self, """
658+ $ bzr mv LOWercaseparent/LOWercase LOWercaseparent/MIXEDCase camelcaseparent
659+ lowercaseparent/lowercase => CamelCaseParent/lowercase
660+ lowercaseparent/mixedCase => CamelCaseParent/mixedCase
661+ """)
662
663
664 class TestMisc(TestCICPBase):
665@@ -222,15 +245,14 @@
666 def test_status(self):
667 wt = self._make_mixed_case_tree()
668 self.run_bzr('add')
669-
670- self.check_output(
671- """added:
672- CamelCaseParent/
673- CamelCaseParent/CamelCase
674- lowercaseparent/
675- lowercaseparent/lowercase
676-""",
677- 'status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE')
678+ run_script(self, """
679+ $ bzr status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE
680+ added:
681+ CamelCaseParent/
682+ CamelCaseParent/CamelCase
683+ lowercaseparent/
684+ lowercaseparent/lowercase
685+ """)
686
687 def test_ci(self):
688 wt = self._make_mixed_case_tree()
689
690=== modified file 'bzrlib/tests/blackbox/test_find_merge_base.py'
691--- bzrlib/tests/blackbox/test_find_merge_base.py 2009-03-23 14:59:43 +0000
692+++ bzrlib/tests/blackbox/test_find_merge_base.py 2010-06-15 06:35:41 +0000
693@@ -16,10 +16,10 @@
694 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
695 import os
696
697-from bzrlib.tests.blackbox import ExternalBase
698-
699-
700-class TestFindMergeBase(ExternalBase):
701+from bzrlib.tests import TestCaseWithTransport
702+
703+
704+class TestFindMergeBase(TestCaseWithTransport):
705
706 def test_find_merge_base(self):
707 a_tree = self.make_branch_and_tree('a')
708
709=== modified file 'bzrlib/tests/blackbox/test_help.py'
710--- bzrlib/tests/blackbox/test_help.py 2010-02-17 17:11:16 +0000
711+++ bzrlib/tests/blackbox/test_help.py 2010-06-15 06:35:41 +0000
712@@ -20,11 +20,11 @@
713
714
715 import bzrlib
716-from bzrlib.tests.blackbox import ExternalBase
717+from bzrlib.tests import TestCaseWithTransport
718 from bzrlib.config import (ensure_config_dir_exists, config_filename)
719
720
721-class TestHelp(ExternalBase):
722+class TestHelp(TestCaseWithTransport):
723
724 def test_help_basic(self):
725 for cmd in ['--help', 'help', '-h', '-?']:
726
727=== modified file 'bzrlib/tests/blackbox/test_ignore.py'
728--- bzrlib/tests/blackbox/test_ignore.py 2010-05-03 09:19:15 +0000
729+++ bzrlib/tests/blackbox/test_ignore.py 2010-06-15 06:35:41 +0000
730@@ -34,11 +34,11 @@
731 pathjoin,
732 )
733 from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
734-from bzrlib.tests.blackbox import ExternalBase
735+from bzrlib.tests import TestCaseWithTransport
736 from bzrlib.workingtree import WorkingTree
737
738
739-class TestCommands(ExternalBase):
740+class TestCommands(TestCaseWithTransport):
741
742 def test_ignore_absolutes(self):
743 """'ignore' with an absolute path returns an error"""
744
745=== modified file 'bzrlib/tests/blackbox/test_ignored.py'
746--- bzrlib/tests/blackbox/test_ignored.py 2010-05-02 20:10:25 +0000
747+++ bzrlib/tests/blackbox/test_ignored.py 2010-06-15 06:35:41 +0000
748@@ -17,10 +17,10 @@
749
750 """Tests of the 'bzr ignored' command."""
751
752-from bzrlib.tests.blackbox import ExternalBase
753-
754-
755-class TestIgnored(ExternalBase):
756+from bzrlib.tests import TestCaseWithTransport
757+
758+
759+class TestIgnored(TestCaseWithTransport):
760
761 def test_ignored_added_file(self):
762 """'bzr ignored' should not list versioned files."""
763
764=== modified file 'bzrlib/tests/blackbox/test_init.py'
765--- bzrlib/tests/blackbox/test_init.py 2010-05-05 14:02:53 +0000
766+++ bzrlib/tests/blackbox/test_init.py 2010-06-15 06:35:41 +0000
767@@ -27,15 +27,15 @@
768 )
769 from bzrlib.bzrdir import BzrDirMetaFormat1
770 from bzrlib.tests import TestSkipped
771-from bzrlib.tests.blackbox import ExternalBase
772+from bzrlib.tests import TestCaseWithTransport
773 from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
774 from bzrlib.workingtree import WorkingTree
775
776
777-class TestInit(ExternalBase):
778+class TestInit(TestCaseWithTransport):
779
780 def setUp(self):
781- ExternalBase.setUp(self)
782+ TestCaseWithTransport.setUp(self)
783 self._default_label = '2a'
784
785 def test_init_with_format(self):
786
787=== modified file 'bzrlib/tests/blackbox/test_modified.py'
788--- bzrlib/tests/blackbox/test_modified.py 2010-05-02 20:10:25 +0000
789+++ bzrlib/tests/blackbox/test_modified.py 2010-06-15 06:35:41 +0000
790@@ -21,9 +21,9 @@
791 import os
792
793 from bzrlib.branch import Branch
794-from bzrlib.tests.blackbox import ExternalBase
795+from bzrlib.tests import TestCaseWithTransport
796
797-class TestModified(ExternalBase):
798+class TestModified(TestCaseWithTransport):
799
800 def test_modified(self):
801 """Test that 'modified' command reports modified files"""
802
803=== modified file 'bzrlib/tests/blackbox/test_nick.py'
804--- bzrlib/tests/blackbox/test_nick.py 2010-05-02 20:10:25 +0000
805+++ bzrlib/tests/blackbox/test_nick.py 2010-06-15 06:35:41 +0000
806@@ -20,10 +20,10 @@
807
808 import bzrlib
809 from bzrlib import osutils
810-from bzrlib.tests.blackbox import ExternalBase
811-
812-
813-class TestNick(ExternalBase):
814+from bzrlib.tests import TestCaseWithTransport
815+
816+
817+class TestNick(TestCaseWithTransport):
818
819 def test_nick_command(self):
820 """bzr nick for viewing, setting nicknames"""
821
822=== modified file 'bzrlib/tests/blackbox/test_pull.py'
823--- bzrlib/tests/blackbox/test_pull.py 2010-02-23 07:43:11 +0000
824+++ bzrlib/tests/blackbox/test_pull.py 2010-06-15 06:35:41 +0000
825@@ -29,12 +29,12 @@
826 from bzrlib.branch import Branch
827 from bzrlib.directory_service import directories
828 from bzrlib.osutils import pathjoin
829-from bzrlib.tests.blackbox import ExternalBase
830+from bzrlib.tests import TestCaseWithTransport
831 from bzrlib.uncommit import uncommit
832 from bzrlib.workingtree import WorkingTree
833
834
835-class TestPull(ExternalBase):
836+class TestPull(TestCaseWithTransport):
837
838 def example_branch(self, path='.'):
839 tree = self.make_branch_and_tree(path)
840
841=== modified file 'bzrlib/tests/blackbox/test_push.py'
842--- bzrlib/tests/blackbox/test_push.py 2010-04-28 10:30:48 +0000
843+++ bzrlib/tests/blackbox/test_push.py 2010-06-15 06:35:41 +0000
844@@ -788,7 +788,7 @@
845 self.assertPushSucceeds([])
846
847
848-class TestPushForeign(blackbox.ExternalBase):
849+class TestPushForeign(tests.TestCaseWithTransport):
850
851 def setUp(self):
852 super(TestPushForeign, self).setUp()
853
854=== modified file 'bzrlib/tests/blackbox/test_remerge.py'
855--- bzrlib/tests/blackbox/test_remerge.py 2010-02-17 17:11:16 +0000
856+++ bzrlib/tests/blackbox/test_remerge.py 2010-06-15 06:35:41 +0000
857@@ -17,11 +17,11 @@
858
859 import os
860
861-from bzrlib.tests.blackbox import ExternalBase
862+from bzrlib.tests import TestCaseWithTransport
863 from bzrlib.workingtree import WorkingTree
864
865
866-class TestRemerge(ExternalBase):
867+class TestRemerge(TestCaseWithTransport):
868
869 def make_file(self, name, contents):
870 f = open(name, 'wb')
871
872=== modified file 'bzrlib/tests/blackbox/test_remove.py'
873--- bzrlib/tests/blackbox/test_remove.py 2009-09-07 08:52:04 +0000
874+++ bzrlib/tests/blackbox/test_remove.py 2010-06-15 06:35:41 +0000
875@@ -19,7 +19,7 @@
876 import sys
877
878 from bzrlib.tests import SymlinkFeature, TestSkipped
879-from bzrlib.tests.blackbox import ExternalBase
880+from bzrlib.tests import TestCaseWithTransport
881 from bzrlib.workingtree import WorkingTree
882 from bzrlib import osutils
883
884@@ -31,7 +31,7 @@
885 files=(a, b, c, d)
886
887
888-class TestRemove(ExternalBase):
889+class TestRemove(TestCaseWithTransport):
890
891 def _make_tree_and_add(self, paths):
892 tree = self.make_branch_and_tree('.')
893
894=== modified file 'bzrlib/tests/blackbox/test_remove_tree.py'
895--- bzrlib/tests/blackbox/test_remove_tree.py 2010-05-28 06:04:57 +0000
896+++ bzrlib/tests/blackbox/test_remove_tree.py 2010-06-15 06:35:41 +0000
897@@ -20,10 +20,10 @@
898 import os
899
900 from bzrlib import shelf
901-from bzrlib.tests.blackbox import ExternalBase
902-
903-
904-class TestRemoveTree(ExternalBase):
905+from bzrlib.tests import TestCaseWithTransport
906+
907+
908+class TestRemoveTree(TestCaseWithTransport):
909
910 def setUp(self):
911 super(TestRemoveTree, self).setUp()
912
913=== modified file 'bzrlib/tests/blackbox/test_revert.py'
914--- bzrlib/tests/blackbox/test_revert.py 2009-08-28 05:00:33 +0000
915+++ bzrlib/tests/blackbox/test_revert.py 2010-06-15 06:35:41 +0000
916@@ -19,12 +19,12 @@
917 import os
918
919 import bzrlib.osutils
920-from bzrlib.tests.blackbox import ExternalBase
921+from bzrlib.tests import TestCaseWithTransport
922 from bzrlib.trace import mutter
923 from bzrlib.workingtree import WorkingTree
924
925
926-class TestRevert(ExternalBase):
927+class TestRevert(TestCaseWithTransport):
928
929 def _prepare_tree(self):
930 self.run_bzr('init')
931
932=== modified file 'bzrlib/tests/blackbox/test_revision_info.py'
933--- bzrlib/tests/blackbox/test_revision_info.py 2009-06-30 16:59:21 +0000
934+++ bzrlib/tests/blackbox/test_revision_info.py 2010-06-15 06:35:41 +0000
935@@ -1,4 +1,4 @@
936-# Copyright (C) 2004, 2005, 2009 Canonical Ltd
937+# Copyright (C) 2004, 2005, 2009, 2010 Canonical Ltd
938 #
939 # This program is free software; you can redistribute it and/or modify
940 # it under the terms of the GNU General Public License as published by
941@@ -17,19 +17,19 @@
942 import os
943
944 from bzrlib.errors import BzrCommandError, NoSuchRevision
945-from bzrlib.tests.blackbox import ExternalBase
946+from bzrlib.tests import TestCaseWithTransport
947 from bzrlib.workingtree import WorkingTree
948
949
950-class TestRevisionInfo(ExternalBase):
951+class TestRevisionInfo(TestCaseWithTransport):
952
953- def check_error(self, output, *args):
954- """Verify that the expected error matches what bzr says.
955+ def check_output(self, output, *args):
956+ """Verify that the expected output matches what bzr says.
957
958 The output is supplied first, so that you can supply a variable
959 number of arguments to bzr.
960 """
961- self.assertContainsRe(self.run_bzr(args, retcode=3)[1], output)
962+ self.assertEquals(self.run_bzr(*args)[0], output)
963
964 def test_revision_info(self):
965 """Test that 'bzr revision-info' reports the correct thing."""
966
967=== modified file 'bzrlib/tests/blackbox/test_rmbranch.py'
968--- bzrlib/tests/blackbox/test_rmbranch.py 2010-03-22 10:11:00 +0000
969+++ bzrlib/tests/blackbox/test_rmbranch.py 2010-06-15 06:35:41 +0000
970@@ -20,12 +20,12 @@
971 from bzrlib import (
972 bzrdir,
973 )
974-from bzrlib.tests.blackbox import (
975- ExternalBase,
976+from bzrlib.tests import (
977+ TestCaseWithTransport,
978 )
979
980
981-class TestRemoveBranch(ExternalBase):
982+class TestRemoveBranch(TestCaseWithTransport):
983
984 def example_branch(self, path='.'):
985 tree = self.make_branch_and_tree(path)
986
987=== modified file 'bzrlib/tests/blackbox/test_switch.py'
988--- bzrlib/tests/blackbox/test_switch.py 2010-05-28 14:15:28 +0000
989+++ bzrlib/tests/blackbox/test_switch.py 2010-06-15 06:35:41 +0000
990@@ -22,11 +22,11 @@
991
992 from bzrlib import osutils
993 from bzrlib.workingtree import WorkingTree
994-from bzrlib.tests.blackbox import ExternalBase
995+from bzrlib.tests import TestCaseWithTransport
996 from bzrlib.directory_service import directories
997
998
999-class TestSwitch(ExternalBase):
1000+class TestSwitch(TestCaseWithTransport):
1001
1002 def _create_sample_tree(self):
1003 tree = self.make_branch_and_tree('branch-1')
1004
1005=== modified file 'bzrlib/tests/blackbox/test_too_much.py'
1006--- bzrlib/tests/blackbox/test_too_much.py 2010-02-17 17:11:16 +0000
1007+++ bzrlib/tests/blackbox/test_too_much.py 2010-06-15 06:35:41 +0000
1008@@ -46,11 +46,11 @@
1009 from bzrlib.errors import BzrCommandError
1010 from bzrlib.tests.http_utils import TestCaseWithWebserver
1011 from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
1012-from bzrlib.tests.blackbox import ExternalBase
1013+from bzrlib.tests import TestCaseWithTransport
1014 from bzrlib.workingtree import WorkingTree
1015
1016
1017-class TestCommands(ExternalBase):
1018+class TestCommands(TestCaseWithTransport):
1019
1020 def test_invalid_commands(self):
1021 self.run_bzr("pants", retcode=3)
1022@@ -354,7 +354,7 @@
1023 return L
1024
1025
1026-class OldTests(ExternalBase):
1027+class OldTests(TestCaseWithTransport):
1028 """old tests moved from ./testbzr."""
1029
1030 def test_bzr(self):
1031
1032=== modified file 'bzrlib/tests/blackbox/test_unknowns.py'
1033--- bzrlib/tests/blackbox/test_unknowns.py 2010-05-02 20:10:25 +0000
1034+++ bzrlib/tests/blackbox/test_unknowns.py 2010-06-15 06:35:41 +0000
1035@@ -18,10 +18,10 @@
1036
1037 """Black-box tests for 'bzr unknowns', which shows unknown files."""
1038
1039-from bzrlib.tests.blackbox import ExternalBase
1040-
1041-
1042-class TestUnknowns(ExternalBase):
1043+from bzrlib.tests import TestCaseWithTransport
1044+
1045+
1046+class TestUnknowns(TestCaseWithTransport):
1047
1048 def test_unknowns(self):
1049 """Test that 'unknown' command reports unknown files"""
1050
1051=== modified file 'bzrlib/tests/blackbox/test_whoami.py'
1052--- bzrlib/tests/blackbox/test_whoami.py 2010-06-07 01:16:10 +0000
1053+++ bzrlib/tests/blackbox/test_whoami.py 2010-06-15 06:35:41 +0000
1054@@ -20,6 +20,7 @@
1055 import os
1056
1057 import bzrlib
1058+<<<<<<< TREE
1059 from bzrlib import (
1060 osutils,
1061 config,
1062@@ -28,6 +29,14 @@
1063
1064
1065 class TestWhoami(ExternalBase):
1066+=======
1067+from bzrlib import osutils
1068+from bzrlib.branch import Branch
1069+from bzrlib.tests import TestCaseWithTransport
1070+
1071+
1072+class TestWhoami(TestCaseWithTransport):
1073+>>>>>>> MERGE-SOURCE
1074
1075 def test_whoami(self):
1076 # this should always identify something, if only "john@localhost"