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
=== modified file 'NEWS'
--- NEWS 2010-06-15 06:35:40 +0000
+++ NEWS 2010-06-15 06:35:41 +0000
@@ -103,6 +103,11 @@
103 ``bzrlib.patiencediff`` instead.103 ``bzrlib.patiencediff`` instead.
104 (Andrew Bennetts)104 (Andrew Bennetts)
105105
106* ``bzrlib.tests.blackbox.ExternalBase`` is deprecated. It provided only
107 one method ``check_output``, and we now recommend checking command
108 output using ``run_script``.
109 (Martin Pool)
110
106Internals111Internals
107*********112*********
108113
109114
=== modified file 'bzrlib/tests/blackbox/__init__.py'
--- bzrlib/tests/blackbox/__init__.py 2010-05-03 09:19:15 +0000
+++ bzrlib/tests/blackbox/__init__.py 2010-06-15 06:35:41 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2005-2010 Canonical Ltd1# Copyright (C) 2005, 2006, 2007, 2010 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -23,6 +23,10 @@
23"""23"""
2424
2525
26from bzrlib.symbol_versioning import (
27 deprecated_in,
28 deprecated_method,
29 )
26from bzrlib import tests30from bzrlib import tests
2731
2832
@@ -126,7 +130,9 @@
126130
127131
128class ExternalBase(tests.TestCaseWithTransport):132class ExternalBase(tests.TestCaseWithTransport):
133 """Don't use this class anymore, use TestCaseWithTransport or similar"""
129134
135 @deprecated_method(deprecated_in((2, 2, 0)))
130 def check_output(self, output, *args):136 def check_output(self, output, *args):
131 """Verify that the expected output matches what bzr says.137 """Verify that the expected output matches what bzr says.
132138
133139
=== modified file 'bzrlib/tests/blackbox/test_added.py'
--- bzrlib/tests/blackbox/test_added.py 2010-05-02 20:10:25 +0000
+++ bzrlib/tests/blackbox/test_added.py 2010-06-15 06:35:41 +0000
@@ -21,10 +21,10 @@
21import os21import os
2222
23from bzrlib.branch import Branch23from bzrlib.branch import Branch
24from bzrlib.tests.blackbox import ExternalBase24from bzrlib.tests import TestCaseWithTransport
2525
2626
27class TestAdded(ExternalBase):27class TestAdded(TestCaseWithTransport):
2828
29 def test_added(self):29 def test_added(self):
30 """Test that 'added' command reports added files"""30 """Test that 'added' command reports added files"""
3131
=== modified file 'bzrlib/tests/blackbox/test_alias.py'
--- bzrlib/tests/blackbox/test_alias.py 2010-04-29 03:23:18 +0000
+++ bzrlib/tests/blackbox/test_alias.py 2010-06-15 06:35:41 +0000
@@ -19,11 +19,11 @@
19import os19import os
20import codecs20import codecs
2121
22from bzrlib.tests.blackbox import ExternalBase22from bzrlib.tests import TestCaseWithTransport
23from bzrlib.config import (ensure_config_dir_exists, config_filename)23from bzrlib.config import (ensure_config_dir_exists, config_filename)
2424
2525
26class TestAlias(ExternalBase):26class TestAlias(TestCaseWithTransport):
2727
28 def test_list_alias_with_none(self):28 def test_list_alias_with_none(self):
29 """Calling alias with no parameters lists existing aliases."""29 """Calling alias with no parameters lists existing aliases."""
3030
=== modified file 'bzrlib/tests/blackbox/test_aliases.py'
--- bzrlib/tests/blackbox/test_aliases.py 2009-03-23 14:59:43 +0000
+++ bzrlib/tests/blackbox/test_aliases.py 2010-06-15 06:35:41 +0000
@@ -19,12 +19,12 @@
19import os19import os
2020
21from bzrlib.branch import Branch21from bzrlib.branch import Branch
22from bzrlib.tests.blackbox import ExternalBase22from bzrlib.tests import TestCaseWithTransport
23from bzrlib.trace import mutter23from bzrlib.trace import mutter
24from bzrlib.config import (ensure_config_dir_exists, config_filename)24from bzrlib.config import (ensure_config_dir_exists, config_filename)
2525
2626
27class TestAliases(ExternalBase):27class TestAliases(TestCaseWithTransport):
2828
29 def test_aliases(self):29 def test_aliases(self):
3030
3131
=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- bzrlib/tests/blackbox/test_branch.py 2010-04-22 17:08:27 +0000
+++ bzrlib/tests/blackbox/test_branch.py 2010-06-15 06:35:41 +0000
@@ -27,7 +27,7 @@
27 revision as _mod_revision,27 revision as _mod_revision,
28 )28 )
29from bzrlib.repofmt.knitrepo import RepositoryFormatKnit129from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
30from bzrlib.tests.blackbox import ExternalBase30from bzrlib.tests import TestCaseWithTransport
31from bzrlib.tests import (31from bzrlib.tests import (
32 KnownFailure,32 KnownFailure,
33 HardlinkFeature,33 HardlinkFeature,
@@ -38,7 +38,7 @@
38from bzrlib.workingtree import WorkingTree38from bzrlib.workingtree import WorkingTree
3939
4040
41class TestBranch(ExternalBase):41class TestBranch(TestCaseWithTransport):
4242
43 def example_branch(self, path='.'):43 def example_branch(self, path='.'):
44 tree = self.make_branch_and_tree(path)44 tree = self.make_branch_and_tree(path)
@@ -248,7 +248,7 @@
248 self.assertLength(2, calls)248 self.assertLength(2, calls)
249249
250250
251class TestBranchStacked(ExternalBase):251class TestBranchStacked(TestCaseWithTransport):
252 """Tests for branch --stacked"""252 """Tests for branch --stacked"""
253253
254 def assertRevisionInRepository(self, repo_path, revid):254 def assertRevisionInRepository(self, repo_path, revid):
@@ -376,7 +376,7 @@
376 err)376 err)
377377
378378
379class TestSmartServerBranching(ExternalBase):379class TestSmartServerBranching(TestCaseWithTransport):
380380
381 def test_branch_from_trivial_branch_to_same_server_branch_acceptance(self):381 def test_branch_from_trivial_branch_to_same_server_branch_acceptance(self):
382 self.setup_smart_server_with_call_log()382 self.setup_smart_server_with_call_log()
383383
=== modified file 'bzrlib/tests/blackbox/test_break_lock.py'
--- bzrlib/tests/blackbox/test_break_lock.py 2010-03-25 09:39:03 +0000
+++ bzrlib/tests/blackbox/test_break_lock.py 2010-06-15 06:35:41 +0000
@@ -25,10 +25,10 @@
25 )25 )
26from bzrlib.branch import Branch26from bzrlib.branch import Branch
27from bzrlib.bzrdir import BzrDir27from bzrlib.bzrdir import BzrDir
28from bzrlib.tests.blackbox import ExternalBase28from bzrlib.tests import TestCaseWithTransport
2929
3030
31class TestBreakLock(ExternalBase):31class TestBreakLock(TestCaseWithTransport):
3232
33 # General principal for break-lock: All the elements that might be locked33 # General principal for break-lock: All the elements that might be locked
34 # by a bzr operation on PATH, are candidates that break-lock may unlock.34 # by a bzr operation on PATH, are candidates that break-lock may unlock.
@@ -93,7 +93,7 @@
93 self.assertRaises(errors.LockBroken, self.master_branch.unlock)93 self.assertRaises(errors.LockBroken, self.master_branch.unlock)
9494
9595
96class TestBreakLockOldBranch(ExternalBase):96class TestBreakLockOldBranch(TestCaseWithTransport):
9797
98 def test_break_lock_format_5_bzrdir(self):98 def test_break_lock_format_5_bzrdir(self):
99 # break lock on a format 5 bzrdir should just return99 # break lock on a format 5 bzrdir should just return
100100
=== modified file 'bzrlib/tests/blackbox/test_cat_revision.py'
--- bzrlib/tests/blackbox/test_cat_revision.py 2010-05-02 20:10:25 +0000
+++ bzrlib/tests/blackbox/test_cat_revision.py 2010-06-15 06:35:41 +0000
@@ -14,10 +14,11 @@
14# along with this program; if not, write to the Free Software14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1616
17from bzrlib.tests import blackbox17
1818from bzrlib.tests import TestCaseWithTransport
1919
20class TestCatRevision(blackbox.ExternalBase):20
21class TestCatRevision(TestCaseWithTransport):
2122
22 def test_cat_unicode_revision(self):23 def test_cat_unicode_revision(self):
23 tree = self.make_branch_and_tree('.')24 tree = self.make_branch_and_tree('.')
@@ -47,17 +48,13 @@
47 finally:48 finally:
48 r.unlock()49 r.unlock()
4950
50 self.check_output(revs[1], 'cat-revision a@r-0-1')51 for i in [1, 2, 3]:
51 self.check_output(revs[2], 'cat-revision a@r-0-2')52 self.assertEqual(revs[i],
52 self.check_output(revs[3], 'cat-revision a@r-0-3')53 self.run_bzr('cat-revision -r revid:a@r-0-%d' % i)[0])
5354 self.assertEqual(revs[i],
54 self.check_output(revs[1], 'cat-revision -r 1')55 self.run_bzr('cat-revision a@r-0-%d' % i)[0])
55 self.check_output(revs[2], 'cat-revision -r 2')56 self.assertEqual(revs[i],
56 self.check_output(revs[3], 'cat-revision -r 3')57 self.run_bzr('cat-revision -r %d' % i)[0])
57
58 self.check_output(revs[1], 'cat-revision -r revid:a@r-0-1')
59 self.check_output(revs[2], 'cat-revision -r revid:a@r-0-2')
60 self.check_output(revs[3], 'cat-revision -r revid:a@r-0-3')
6158
62 def test_cat_no_such_revid(self):59 def test_cat_no_such_revid(self):
63 tree = self.make_branch_and_tree('.')60 tree = self.make_branch_and_tree('.')
6461
=== modified file 'bzrlib/tests/blackbox/test_check.py'
--- bzrlib/tests/blackbox/test_check.py 2009-08-04 04:36:34 +0000
+++ bzrlib/tests/blackbox/test_check.py 2010-06-15 06:35:41 +0000
@@ -17,10 +17,10 @@
17"""Tests for the 'check' CLI command."""17"""Tests for the 'check' CLI command."""
1818
19from bzrlib.tests import ChrootedTestCase19from bzrlib.tests import ChrootedTestCase
20from bzrlib.tests.blackbox import ExternalBase20from bzrlib.tests import TestCaseWithTransport
2121
2222
23class TestCheck(ExternalBase):23class TestCheck(TestCaseWithTransport):
2424
25 def test_check_no_tree(self):25 def test_check_no_tree(self):
26 self.make_branch('.')26 self.make_branch('.')
2727
=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
--- bzrlib/tests/blackbox/test_checkout.py 2010-05-12 12:55:04 +0000
+++ bzrlib/tests/blackbox/test_checkout.py 2010-06-15 06:35:41 +0000
@@ -28,8 +28,8 @@
28 errors,28 errors,
29 workingtree,29 workingtree,
30 )30 )
31from bzrlib.tests.blackbox import (31from bzrlib.tests import (
32 ExternalBase,32 TestCaseWithTransport,
33 )33 )
34from bzrlib.tests import (34from bzrlib.tests import (
35 HardlinkFeature,35 HardlinkFeature,
@@ -37,7 +37,7 @@
37 )37 )
3838
3939
40class TestCheckout(ExternalBase):40class TestCheckout(TestCaseWithTransport):
4141
42 def setUp(self):42 def setUp(self):
43 super(TestCheckout, self).setUp()43 super(TestCheckout, self).setUp()
4444
=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- bzrlib/tests/blackbox/test_commit.py 2010-05-20 18:23:17 +0000
+++ bzrlib/tests/blackbox/test_commit.py 2010-06-15 06:35:41 +0000
@@ -33,10 +33,10 @@
33 probe_bad_non_ascii,33 probe_bad_non_ascii,
34 TestSkipped,34 TestSkipped,
35 )35 )
36from bzrlib.tests.blackbox import ExternalBase36from bzrlib.tests import TestCaseWithTransport
3737
3838
39class TestCommit(ExternalBase):39class TestCommit(TestCaseWithTransport):
4040
41 def test_05_empty_commit(self):41 def test_05_empty_commit(self):
42 """Commit of tree with no versioned files should fail"""42 """Commit of tree with no versioned files should fail"""
4343
=== modified file 'bzrlib/tests/blackbox/test_deleted.py'
--- bzrlib/tests/blackbox/test_deleted.py 2010-05-02 20:10:25 +0000
+++ bzrlib/tests/blackbox/test_deleted.py 2010-06-15 06:35:41 +0000
@@ -21,10 +21,10 @@
21import os21import os
2222
23from bzrlib.branch import Branch23from bzrlib.branch import Branch
24from bzrlib.tests.blackbox import ExternalBase24from bzrlib.tests import TestCaseWithTransport
2525
2626
27class TestDeleted(ExternalBase):27class TestDeleted(TestCaseWithTransport):
2828
29 def test_deleted_directory(self):29 def test_deleted_directory(self):
30 """Test --directory option"""30 """Test --directory option"""
3131
=== modified file 'bzrlib/tests/blackbox/test_dpush.py'
--- bzrlib/tests/blackbox/test_dpush.py 2010-04-28 10:30:48 +0000
+++ bzrlib/tests/blackbox/test_dpush.py 2010-06-15 06:35:41 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2009, 2010 Canonical Ltd1# Copyright (C) 2005, 2007, 2008, 2009, 2010 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@
29 )29 )
30from bzrlib.tests import (30from bzrlib.tests import (
31 blackbox,31 blackbox,
32 script,
32 test_foreign,33 test_foreign,
33 )34 )
34from bzrlib.tests.blackbox import test_push35from bzrlib.tests.blackbox import test_push
@@ -58,7 +59,7 @@
58 return result59 return result
5960
6061
61class TestDpush(blackbox.ExternalBase):62class TestDpush(tests.TestCaseWithTransport):
6263
63 def setUp(self):64 def setUp(self):
64 super(TestDpush, self).setUp()65 super(TestDpush, self).setUp()
@@ -86,9 +87,11 @@
86 self.build_tree(("dc/foo", "blaaaa"))87 self.build_tree(("dc/foo", "blaaaa"))
87 dc.open_workingtree().commit('msg')88 dc.open_workingtree().commit('msg')
8889
89 output, error = self.run_bzr("dpush -d dc d")90 script.run_script(self, """
90 self.assertEquals(error, "Pushed up to revision 2.\n")91 $ bzr dpush -d dc d
91 self.check_output("", "status dc")92 2>Pushed up to revision 2.
93 $ bzr status dc
94 """)
9295
93 def test_dpush_new(self):96 def test_dpush_new(self):
94 b = self.make_dummy_builder('d').get_branch()97 b = self.make_dummy_builder('d').get_branch()
@@ -99,9 +102,12 @@
99 dc_tree.add("foofile")102 dc_tree.add("foofile")
100 dc_tree.commit("msg")103 dc_tree.commit("msg")
101104
102 self.check_output("", "dpush -d dc d")105 script.run_script(self, '''
103 self.check_output("2\n", "revno dc")106 $ bzr dpush -d dc d
104 self.check_output("", "status dc")107 $ bzr revno dc
108 2
109 $ bzr status dc
110 ''')
105111
106 def test_dpush_wt_diff(self):112 def test_dpush_wt_diff(self):
107 b = self.make_dummy_builder('d').get_branch()113 b = self.make_dummy_builder('d').get_branch()
@@ -113,11 +119,17 @@
113 newrevid = dc_tree.commit('msg')119 newrevid = dc_tree.commit('msg')
114120
115 self.build_tree_contents([("dc/foofile", "blaaaal")])121 self.build_tree_contents([("dc/foofile", "blaaaal")])
116 self.check_output("", "dpush -d dc d --no-strict")122 script.run_script(self, '''
123 $ bzr dpush -d dc d --no-strict
124 ''')
117 self.assertFileEqual("blaaaal", "dc/foofile")125 self.assertFileEqual("blaaaal", "dc/foofile")
118 # if the dummy vcs wasn't that dummy we could uncomment the line below126 # if the dummy vcs wasn't that dummy we could uncomment the line below
119 # self.assertFileEqual("blaaaa", "d/foofile")127 # self.assertFileEqual("blaaaa", "d/foofile")
120 self.check_output('modified:\n foofile\n', "status dc")128 script.run_script(self, '''
129 $ bzr status dc
130 modified:
131 foofile
132 ''')
121133
122 def test_diverged(self):134 def test_diverged(self):
123 builder = self.make_dummy_builder('d')135 builder = self.make_dummy_builder('d')
124136
=== modified file 'bzrlib/tests/blackbox/test_export.py'
--- bzrlib/tests/blackbox/test_export.py 2010-05-02 20:10:25 +0000
+++ bzrlib/tests/blackbox/test_export.py 2010-06-15 06:35:41 +0000
@@ -30,10 +30,10 @@
30 export,30 export,
31 tests,31 tests,
32 )32 )
33from bzrlib.tests.blackbox import ExternalBase33from bzrlib.tests import TestCaseWithTransport
3434
3535
36class TestExport(ExternalBase):36class TestExport(TestCaseWithTransport):
3737
38 def test_tar_export(self):38 def test_tar_export(self):
39 tree = self.make_branch_and_tree('tar')39 tree = self.make_branch_and_tree('tar')
4040
=== modified file 'bzrlib/tests/blackbox/test_filesystem_cicp.py'
--- bzrlib/tests/blackbox/test_filesystem_cicp.py 2010-04-28 07:53:34 +0000
+++ bzrlib/tests/blackbox/test_filesystem_cicp.py 2010-06-15 06:35:41 +0000
@@ -19,13 +19,16 @@
1919
20import os20import os
2121
22from bzrlib import (osutils,22from bzrlib import (
23 osutils,
24 tests,
23 )25 )
24from bzrlib.tests.blackbox import ExternalBase
25from bzrlib.tests import CaseInsCasePresFilenameFeature, KnownFailure26from bzrlib.tests import CaseInsCasePresFilenameFeature, KnownFailure
26from bzrlib.osutils import canonical_relpath, pathjoin27from bzrlib.osutils import canonical_relpath, pathjoin
2728from bzrlib.tests.script import run_script
28class TestCICPBase(ExternalBase):29
30
31class TestCICPBase(tests.TestCaseWithTransport):
29 """Base class for tests on a case-insensitive, case-preserving filesystem.32 """Base class for tests on a case-insensitive, case-preserving filesystem.
30 """33 """
3134
@@ -42,16 +45,6 @@
42 ])45 ])
43 return wt46 return wt
4447
45 def check_error_output(self, retcode, output, *args):
46 got = self.run_bzr(retcode=retcode, *args)[1]
47 self.failUnlessEqual(got, output)
48
49 def check_empty_output(self, *args):
50 """Check a bzr command generates no output anywhere and exits with 0"""
51 out, err = self.run_bzr(retcode=0, *args)
52 self.failIf(out)
53 self.failIf(err)
54
5548
56class TestAdd(TestCICPBase):49class TestAdd(TestCICPBase):
5750
@@ -60,28 +53,32 @@
60 wt = self.make_branch_and_tree('.')53 wt = self.make_branch_and_tree('.')
61 # create a file on disk with the mixed-case name54 # create a file on disk with the mixed-case name
62 self.build_tree(['CamelCase'])55 self.build_tree(['CamelCase'])
6356 run_script(self, """
64 self.check_output('adding CamelCase\n', 'add camelcase')57 $ bzr add camelcase
58 adding CamelCase
59 """)
6560
66 def test_add_subdir(self):61 def test_add_subdir(self):
67 """test_add_simple but with subdirectories tested too."""62 """test_add_simple but with subdirectories tested too."""
68 wt = self.make_branch_and_tree('.')63 wt = self.make_branch_and_tree('.')
69 # create a file on disk with the mixed-case parent and base name64 # create a file on disk with the mixed-case parent and base name
70 self.build_tree(['CamelCaseParent/', 'CamelCaseParent/CamelCase'])65 self.build_tree(['CamelCaseParent/', 'CamelCaseParent/CamelCase'])
7166 run_script(self, """
72 self.check_output('adding CamelCaseParent\n'67 $ bzr add camelcaseparent/camelcase
73 'adding CamelCaseParent/CamelCase\n',68 adding CamelCaseParent
74 'add camelcaseparent/camelcase')69 adding CamelCaseParent/CamelCase
70 """)
7571
76 def test_add_implied(self):72 def test_add_implied(self):
77 """test add with no args sees the correct names."""73 """test add with no args sees the correct names."""
78 wt = self.make_branch_and_tree('.')74 wt = self.make_branch_and_tree('.')
79 # create a file on disk with the mixed-case parent and base name75 # create a file on disk with the mixed-case parent and base name
80 self.build_tree(['CamelCaseParent/', 'CamelCaseParent/CamelCase'])76 self.build_tree(['CamelCaseParent/', 'CamelCaseParent/CamelCase'])
8177 run_script(self, """
82 self.check_output('adding CamelCaseParent\n'78 $ bzr add
83 'adding CamelCaseParent/CamelCase\n',79 adding CamelCaseParent
84 'add')80 adding CamelCaseParent/CamelCase
81 """)
8582
86 def test_re_add(self):83 def test_re_add(self):
87 """Test than when a file has 'unintentionally' changed case, we can't84 """Test than when a file has 'unintentionally' changed case, we can't
@@ -89,10 +86,15 @@
89 wt = self.make_branch_and_tree('.')86 wt = self.make_branch_and_tree('.')
90 # create a file on disk with the mixed-case name87 # create a file on disk with the mixed-case name
91 self.build_tree(['MixedCase'])88 self.build_tree(['MixedCase'])
92 self.check_output('adding MixedCase\n', 'add MixedCase')89 run_script(self, """
90 $ bzr add MixedCase
91 adding MixedCase
92 """)
93 # 'accidently' rename the file on disk93 # 'accidently' rename the file on disk
94 osutils.rename('MixedCase', 'mixedcase')94 osutils.rename('MixedCase', 'mixedcase')
95 self.check_empty_output('add mixedcase')95 run_script(self, """
96 $ bzr add mixedcase
97 """)
9698
97 def test_re_add_dir(self):99 def test_re_add_dir(self):
98 # like re-add, but tests when the operation is on a directory.100 # like re-add, but tests when the operation is on a directory.
@@ -101,12 +103,16 @@
101 wt = self.make_branch_and_tree('.')103 wt = self.make_branch_and_tree('.')
102 # create a file on disk with the mixed-case name104 # create a file on disk with the mixed-case name
103 self.build_tree(['MixedCaseParent/', 'MixedCaseParent/MixedCase'])105 self.build_tree(['MixedCaseParent/', 'MixedCaseParent/MixedCase'])
104 self.check_output('adding MixedCaseParent\n'106 run_script(self, """
105 'adding MixedCaseParent/MixedCase\n',107 $ bzr add MixedCaseParent
106 'add MixedCaseParent')108 adding MixedCaseParent
109 adding MixedCaseParent/MixedCase
110 """)
107 # 'accidently' rename the directory on disk111 # 'accidently' rename the directory on disk
108 osutils.rename('MixedCaseParent', 'mixedcaseparent')112 osutils.rename('MixedCaseParent', 'mixedcaseparent')
109 self.check_empty_output('add mixedcaseparent')113 run_script(self, """
114 $ bzr add mixedcaseparent
115 """)
110116
111 def test_add_not_found(self):117 def test_add_not_found(self):
112 """Test add when the input file doesn't exist."""118 """Test add when the input file doesn't exist."""
@@ -114,31 +120,34 @@
114 # create a file on disk with the mixed-case name120 # create a file on disk with the mixed-case name
115 self.build_tree(['MixedCaseParent/', 'MixedCaseParent/MixedCase'])121 self.build_tree(['MixedCaseParent/', 'MixedCaseParent/MixedCase'])
116 expected_fname = pathjoin(wt.basedir, "MixedCaseParent", "notfound")122 expected_fname = pathjoin(wt.basedir, "MixedCaseParent", "notfound")
117 expected_msg = "bzr: ERROR: No such file: %r\n" % expected_fname123 run_script(self, """
118 self.check_error_output(3, expected_msg, 'add mixedcaseparent/notfound')124 $ bzr add mixedcaseparent/notfound
125 2>bzr: ERROR: No such file: %s
126 """ % (repr(expected_fname),))
119127
120128
121class TestMove(TestCICPBase):129class TestMove(TestCICPBase):
130
122 def test_mv_newname(self):131 def test_mv_newname(self):
123 wt = self._make_mixed_case_tree()132 wt = self._make_mixed_case_tree()
124 self.run_bzr('add')133 run_script(self, """
125 self.run_bzr('ci -m message')134 $ bzr add
126135 $ bzr ci -m message
127 self.check_output(136 $ bzr mv camelcaseparent/camelcase camelcaseparent/NewCamelCase
128 'CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase\n',137 CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase
129 'mv camelcaseparent/camelcase camelcaseparent/NewCamelCase')138 """)
130139
131 def test_mv_newname_after(self):140 def test_mv_newname_after(self):
132 wt = self._make_mixed_case_tree()141 wt = self._make_mixed_case_tree()
133 self.run_bzr('add')
134 self.run_bzr('ci -m message')
135 osutils.rename('CamelCaseParent/CamelCase', 'CamelCaseParent/NewCamelCase')
136
137 # In this case we can specify the incorrect case for the destination,142 # In this case we can specify the incorrect case for the destination,
138 # as we use --after, so the file-system is sniffed.143 # as we use --after, so the file-system is sniffed.
139 self.check_output(144 run_script(self, """
140 'CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase\n',145 $ bzr add
141 'mv --after camelcaseparent/camelcase camelcaseparent/newcamelcase')146 $ bzr ci -m message
147 $ mv CamelCaseParent/CamelCase CamelCaseParent/NewCamelCase
148 $ bzr mv --after camelcaseparent/camelcase camelcaseparent/newcamelcase
149 CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase
150 """)
142151
143 def test_mv_newname_exists(self):152 def test_mv_newname_exists(self):
144 # test a mv, but when the target already exists with a name that153 # test a mv, but when the target already exists with a name that
@@ -146,8 +155,11 @@
146 wt = self._make_mixed_case_tree()155 wt = self._make_mixed_case_tree()
147 self.run_bzr('add')156 self.run_bzr('add')
148 self.run_bzr('ci -m message')157 self.run_bzr('ci -m message')
149 ex = 'bzr: ERROR: Could not move CamelCase => lowercase: lowercaseparent/lowercase is already versioned.\n'158 run_script(self, """
150 self.check_error_output(3, ex, 'mv camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE')159 $ bzr mv camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE
160 2>bzr: ERROR: Could not move CamelCase => lowercase: \
161lowercaseparent/lowercase is already versioned.
162 """)
151163
152 def test_mv_newname_exists_after(self):164 def test_mv_newname_exists_after(self):
153 # test a 'mv --after', but when the target already exists with a name165 # test a 'mv --after', but when the target already exists with a name
@@ -160,27 +172,32 @@
160 # bzr should report that the filename is already versioned.172 # bzr should report that the filename is already versioned.
161 os.unlink('CamelCaseParent/CamelCase')173 os.unlink('CamelCaseParent/CamelCase')
162 osutils.rename('lowercaseparent/lowercase', 'lowercaseparent/LOWERCASE')174 osutils.rename('lowercaseparent/lowercase', 'lowercaseparent/LOWERCASE')
163 ex = 'bzr: ERROR: Could not move CamelCase => lowercase: lowercaseparent/lowercase is already versioned.\n'175 run_script(self, """
164 self.check_error_output(3, ex, 'mv --after camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE')176 $ bzr mv --after camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE
177 2>bzr: ERROR: Could not move CamelCase => lowercase: \
178lowercaseparent/lowercase is already versioned.
179 """)
165180
166 def test_mv_newname_root(self):181 def test_mv_newname_root(self):
167 wt = self._make_mixed_case_tree()182 wt = self._make_mixed_case_tree()
168 self.run_bzr('add')183 self.run_bzr('add')
169 self.run_bzr('ci -m message')184 self.run_bzr('ci -m message')
170185 run_script(self, """
171 self.check_output('CamelCaseParent => NewCamelCaseParent\n',186 $ bzr mv camelcaseparent NewCamelCaseParent
172 'mv camelcaseparent NewCamelCaseParent')187 CamelCaseParent => NewCamelCaseParent
188 """)
173189
174 def test_mv_newname_root_after(self):190 def test_mv_newname_root_after(self):
175 wt = self._make_mixed_case_tree()191 wt = self._make_mixed_case_tree()
176 self.run_bzr('add')192 self.run_bzr('add')
177 self.run_bzr('ci -m message')193 self.run_bzr('ci -m message')
178 osutils.rename('CamelCaseParent', 'NewCamelCaseParent')
179
180 # In this case we can specify the incorrect case for the destination,194 # In this case we can specify the incorrect case for the destination,
181 # as we use --after, so the file-system is sniffed.195 # as we use --after, so the file-system is sniffed.
182 self.check_output('CamelCaseParent => NewCamelCaseParent\n',196 run_script(self, """
183 'mv --after camelcaseparent newcamelcaseparent')197 $ mv CamelCaseParent NewCamelCaseParent
198 $ bzr mv --after camelcaseparent NewCamelCaseParent
199 CamelCaseParent => NewCamelCaseParent
200 """)
184201
185 def test_mv_newcase(self):202 def test_mv_newcase(self):
186 wt = self._make_mixed_case_tree()203 wt = self._make_mixed_case_tree()
@@ -189,8 +206,10 @@
189206
190 # perform a mv to the new case - we expect bzr to accept the new207 # perform a mv to the new case - we expect bzr to accept the new
191 # name, as specified, and rename the file on the file-system too.208 # name, as specified, and rename the file on the file-system too.
192 self.check_output('CamelCaseParent/CamelCase => CamelCaseParent/camelCase\n',209 run_script(self, """
193 'mv camelcaseparent/camelcase camelcaseparent/camelCase')210 $ bzr mv camelcaseparent/camelcase camelcaseparent/camelCase
211 CamelCaseParent/CamelCase => CamelCaseParent/camelCase
212 """)
194 self.failUnlessEqual(canonical_relpath(wt.basedir, 'camelcaseparent/camelcase'),213 self.failUnlessEqual(canonical_relpath(wt.basedir, 'camelcaseparent/camelcase'),
195 'CamelCaseParent/camelCase')214 'CamelCaseParent/camelCase')
196215
@@ -202,8 +221,10 @@
202 # perform a mv to the new case - we must ensure the file-system has the221 # perform a mv to the new case - we must ensure the file-system has the
203 # new case first.222 # new case first.
204 osutils.rename('CamelCaseParent/CamelCase', 'CamelCaseParent/camelCase')223 osutils.rename('CamelCaseParent/CamelCase', 'CamelCaseParent/camelCase')
205 self.check_output('CamelCaseParent/CamelCase => CamelCaseParent/camelCase\n',224 run_script(self, """
206 'mv --after camelcaseparent/camelcase camelcaseparent/camelCase')225 $ bzr mv --after camelcaseparent/camelcase camelcaseparent/camelCase
226 CamelCaseParent/CamelCase => CamelCaseParent/camelCase
227 """)
207 # bzr should not have renamed the file to a different case228 # bzr should not have renamed the file to a different case
208 self.failUnlessEqual(canonical_relpath(wt.basedir, 'camelcaseparent/camelcase'),229 self.failUnlessEqual(canonical_relpath(wt.basedir, 'camelcaseparent/camelcase'),
209 'CamelCaseParent/camelCase')230 'CamelCaseParent/camelCase')
@@ -212,9 +233,11 @@
212 wt = self._make_mixed_case_tree()233 wt = self._make_mixed_case_tree()
213 self.run_bzr('add')234 self.run_bzr('add')
214 self.run_bzr('ci -m message')235 self.run_bzr('ci -m message')
215 self.check_output('lowercaseparent/lowercase => CamelCaseParent/lowercase\n'236 run_script(self, """
216 'lowercaseparent/mixedCase => CamelCaseParent/mixedCase\n',237 $ bzr mv LOWercaseparent/LOWercase LOWercaseparent/MIXEDCase camelcaseparent
217 'mv LOWercaseparent/LOWercase LOWercaseparent/MIXEDCase camelcaseparent')238 lowercaseparent/lowercase => CamelCaseParent/lowercase
239 lowercaseparent/mixedCase => CamelCaseParent/mixedCase
240 """)
218241
219242
220class TestMisc(TestCICPBase):243class TestMisc(TestCICPBase):
@@ -222,15 +245,14 @@
222 def test_status(self):245 def test_status(self):
223 wt = self._make_mixed_case_tree()246 wt = self._make_mixed_case_tree()
224 self.run_bzr('add')247 self.run_bzr('add')
225248 run_script(self, """
226 self.check_output(249 $ bzr status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE
227 """added:250 added:
228 CamelCaseParent/251 CamelCaseParent/
229 CamelCaseParent/CamelCase252 CamelCaseParent/CamelCase
230 lowercaseparent/253 lowercaseparent/
231 lowercaseparent/lowercase254 lowercaseparent/lowercase
232""",255 """)
233 'status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE')
234256
235 def test_ci(self):257 def test_ci(self):
236 wt = self._make_mixed_case_tree()258 wt = self._make_mixed_case_tree()
237259
=== modified file 'bzrlib/tests/blackbox/test_find_merge_base.py'
--- bzrlib/tests/blackbox/test_find_merge_base.py 2009-03-23 14:59:43 +0000
+++ bzrlib/tests/blackbox/test_find_merge_base.py 2010-06-15 06:35:41 +0000
@@ -16,10 +16,10 @@
16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17import os17import os
1818
19from bzrlib.tests.blackbox import ExternalBase19from bzrlib.tests import TestCaseWithTransport
2020
2121
22class TestFindMergeBase(ExternalBase):22class TestFindMergeBase(TestCaseWithTransport):
2323
24 def test_find_merge_base(self):24 def test_find_merge_base(self):
25 a_tree = self.make_branch_and_tree('a')25 a_tree = self.make_branch_and_tree('a')
2626
=== modified file 'bzrlib/tests/blackbox/test_help.py'
--- bzrlib/tests/blackbox/test_help.py 2010-02-17 17:11:16 +0000
+++ bzrlib/tests/blackbox/test_help.py 2010-06-15 06:35:41 +0000
@@ -20,11 +20,11 @@
2020
2121
22import bzrlib22import bzrlib
23from bzrlib.tests.blackbox import ExternalBase23from bzrlib.tests import TestCaseWithTransport
24from bzrlib.config import (ensure_config_dir_exists, config_filename)24from bzrlib.config import (ensure_config_dir_exists, config_filename)
2525
2626
27class TestHelp(ExternalBase):27class TestHelp(TestCaseWithTransport):
2828
29 def test_help_basic(self):29 def test_help_basic(self):
30 for cmd in ['--help', 'help', '-h', '-?']:30 for cmd in ['--help', 'help', '-h', '-?']:
3131
=== modified file 'bzrlib/tests/blackbox/test_ignore.py'
--- bzrlib/tests/blackbox/test_ignore.py 2010-05-03 09:19:15 +0000
+++ bzrlib/tests/blackbox/test_ignore.py 2010-06-15 06:35:41 +0000
@@ -34,11 +34,11 @@
34 pathjoin,34 pathjoin,
35 )35 )
36from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer36from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
37from bzrlib.tests.blackbox import ExternalBase37from bzrlib.tests import TestCaseWithTransport
38from bzrlib.workingtree import WorkingTree38from bzrlib.workingtree import WorkingTree
3939
4040
41class TestCommands(ExternalBase):41class TestCommands(TestCaseWithTransport):
4242
43 def test_ignore_absolutes(self):43 def test_ignore_absolutes(self):
44 """'ignore' with an absolute path returns an error"""44 """'ignore' with an absolute path returns an error"""
4545
=== modified file 'bzrlib/tests/blackbox/test_ignored.py'
--- bzrlib/tests/blackbox/test_ignored.py 2010-05-02 20:10:25 +0000
+++ bzrlib/tests/blackbox/test_ignored.py 2010-06-15 06:35:41 +0000
@@ -17,10 +17,10 @@
1717
18"""Tests of the 'bzr ignored' command."""18"""Tests of the 'bzr ignored' command."""
1919
20from bzrlib.tests.blackbox import ExternalBase20from bzrlib.tests import TestCaseWithTransport
2121
2222
23class TestIgnored(ExternalBase):23class TestIgnored(TestCaseWithTransport):
2424
25 def test_ignored_added_file(self):25 def test_ignored_added_file(self):
26 """'bzr ignored' should not list versioned files."""26 """'bzr ignored' should not list versioned files."""
2727
=== modified file 'bzrlib/tests/blackbox/test_init.py'
--- bzrlib/tests/blackbox/test_init.py 2010-05-05 14:02:53 +0000
+++ bzrlib/tests/blackbox/test_init.py 2010-06-15 06:35:41 +0000
@@ -27,15 +27,15 @@
27 )27 )
28from bzrlib.bzrdir import BzrDirMetaFormat128from bzrlib.bzrdir import BzrDirMetaFormat1
29from bzrlib.tests import TestSkipped29from bzrlib.tests import TestSkipped
30from bzrlib.tests.blackbox import ExternalBase30from bzrlib.tests import TestCaseWithTransport
31from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer31from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
32from bzrlib.workingtree import WorkingTree32from bzrlib.workingtree import WorkingTree
3333
3434
35class TestInit(ExternalBase):35class TestInit(TestCaseWithTransport):
3636
37 def setUp(self):37 def setUp(self):
38 ExternalBase.setUp(self)38 TestCaseWithTransport.setUp(self)
39 self._default_label = '2a'39 self._default_label = '2a'
4040
41 def test_init_with_format(self):41 def test_init_with_format(self):
4242
=== modified file 'bzrlib/tests/blackbox/test_modified.py'
--- bzrlib/tests/blackbox/test_modified.py 2010-05-02 20:10:25 +0000
+++ bzrlib/tests/blackbox/test_modified.py 2010-06-15 06:35:41 +0000
@@ -21,9 +21,9 @@
21import os21import os
2222
23from bzrlib.branch import Branch23from bzrlib.branch import Branch
24from bzrlib.tests.blackbox import ExternalBase24from bzrlib.tests import TestCaseWithTransport
2525
26class TestModified(ExternalBase):26class TestModified(TestCaseWithTransport):
2727
28 def test_modified(self):28 def test_modified(self):
29 """Test that 'modified' command reports modified files"""29 """Test that 'modified' command reports modified files"""
3030
=== modified file 'bzrlib/tests/blackbox/test_nick.py'
--- bzrlib/tests/blackbox/test_nick.py 2010-05-02 20:10:25 +0000
+++ bzrlib/tests/blackbox/test_nick.py 2010-06-15 06:35:41 +0000
@@ -20,10 +20,10 @@
2020
21import bzrlib21import bzrlib
22from bzrlib import osutils22from bzrlib import osutils
23from bzrlib.tests.blackbox import ExternalBase23from bzrlib.tests import TestCaseWithTransport
2424
2525
26class TestNick(ExternalBase):26class TestNick(TestCaseWithTransport):
2727
28 def test_nick_command(self):28 def test_nick_command(self):
29 """bzr nick for viewing, setting nicknames"""29 """bzr nick for viewing, setting nicknames"""
3030
=== modified file 'bzrlib/tests/blackbox/test_pull.py'
--- bzrlib/tests/blackbox/test_pull.py 2010-02-23 07:43:11 +0000
+++ bzrlib/tests/blackbox/test_pull.py 2010-06-15 06:35:41 +0000
@@ -29,12 +29,12 @@
29from bzrlib.branch import Branch29from bzrlib.branch import Branch
30from bzrlib.directory_service import directories30from bzrlib.directory_service import directories
31from bzrlib.osutils import pathjoin31from bzrlib.osutils import pathjoin
32from bzrlib.tests.blackbox import ExternalBase32from bzrlib.tests import TestCaseWithTransport
33from bzrlib.uncommit import uncommit33from bzrlib.uncommit import uncommit
34from bzrlib.workingtree import WorkingTree34from bzrlib.workingtree import WorkingTree
3535
3636
37class TestPull(ExternalBase):37class TestPull(TestCaseWithTransport):
3838
39 def example_branch(self, path='.'):39 def example_branch(self, path='.'):
40 tree = self.make_branch_and_tree(path)40 tree = self.make_branch_and_tree(path)
4141
=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- bzrlib/tests/blackbox/test_push.py 2010-04-28 10:30:48 +0000
+++ bzrlib/tests/blackbox/test_push.py 2010-06-15 06:35:41 +0000
@@ -788,7 +788,7 @@
788 self.assertPushSucceeds([])788 self.assertPushSucceeds([])
789789
790790
791class TestPushForeign(blackbox.ExternalBase):791class TestPushForeign(tests.TestCaseWithTransport):
792792
793 def setUp(self):793 def setUp(self):
794 super(TestPushForeign, self).setUp()794 super(TestPushForeign, self).setUp()
795795
=== modified file 'bzrlib/tests/blackbox/test_remerge.py'
--- bzrlib/tests/blackbox/test_remerge.py 2010-02-17 17:11:16 +0000
+++ bzrlib/tests/blackbox/test_remerge.py 2010-06-15 06:35:41 +0000
@@ -17,11 +17,11 @@
1717
18import os18import os
1919
20from bzrlib.tests.blackbox import ExternalBase20from bzrlib.tests import TestCaseWithTransport
21from bzrlib.workingtree import WorkingTree21from bzrlib.workingtree import WorkingTree
2222
2323
24class TestRemerge(ExternalBase):24class TestRemerge(TestCaseWithTransport):
2525
26 def make_file(self, name, contents):26 def make_file(self, name, contents):
27 f = open(name, 'wb')27 f = open(name, 'wb')
2828
=== modified file 'bzrlib/tests/blackbox/test_remove.py'
--- bzrlib/tests/blackbox/test_remove.py 2009-09-07 08:52:04 +0000
+++ bzrlib/tests/blackbox/test_remove.py 2010-06-15 06:35:41 +0000
@@ -19,7 +19,7 @@
19import sys19import sys
2020
21from bzrlib.tests import SymlinkFeature, TestSkipped21from bzrlib.tests import SymlinkFeature, TestSkipped
22from bzrlib.tests.blackbox import ExternalBase22from bzrlib.tests import TestCaseWithTransport
23from bzrlib.workingtree import WorkingTree23from bzrlib.workingtree import WorkingTree
24from bzrlib import osutils24from bzrlib import osutils
2525
@@ -31,7 +31,7 @@
31files=(a, b, c, d)31files=(a, b, c, d)
3232
3333
34class TestRemove(ExternalBase):34class TestRemove(TestCaseWithTransport):
3535
36 def _make_tree_and_add(self, paths):36 def _make_tree_and_add(self, paths):
37 tree = self.make_branch_and_tree('.')37 tree = self.make_branch_and_tree('.')
3838
=== modified file 'bzrlib/tests/blackbox/test_remove_tree.py'
--- bzrlib/tests/blackbox/test_remove_tree.py 2010-05-28 06:04:57 +0000
+++ bzrlib/tests/blackbox/test_remove_tree.py 2010-06-15 06:35:41 +0000
@@ -20,10 +20,10 @@
20import os20import os
2121
22from bzrlib import shelf22from bzrlib import shelf
23from bzrlib.tests.blackbox import ExternalBase23from bzrlib.tests import TestCaseWithTransport
2424
2525
26class TestRemoveTree(ExternalBase):26class TestRemoveTree(TestCaseWithTransport):
2727
28 def setUp(self):28 def setUp(self):
29 super(TestRemoveTree, self).setUp()29 super(TestRemoveTree, self).setUp()
3030
=== modified file 'bzrlib/tests/blackbox/test_revert.py'
--- bzrlib/tests/blackbox/test_revert.py 2009-08-28 05:00:33 +0000
+++ bzrlib/tests/blackbox/test_revert.py 2010-06-15 06:35:41 +0000
@@ -19,12 +19,12 @@
19import os19import os
2020
21import bzrlib.osutils21import bzrlib.osutils
22from bzrlib.tests.blackbox import ExternalBase22from bzrlib.tests import TestCaseWithTransport
23from bzrlib.trace import mutter23from bzrlib.trace import mutter
24from bzrlib.workingtree import WorkingTree24from bzrlib.workingtree import WorkingTree
2525
2626
27class TestRevert(ExternalBase):27class TestRevert(TestCaseWithTransport):
2828
29 def _prepare_tree(self):29 def _prepare_tree(self):
30 self.run_bzr('init')30 self.run_bzr('init')
3131
=== modified file 'bzrlib/tests/blackbox/test_revision_info.py'
--- bzrlib/tests/blackbox/test_revision_info.py 2009-06-30 16:59:21 +0000
+++ bzrlib/tests/blackbox/test_revision_info.py 2010-06-15 06:35:41 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2004, 2005, 2009 Canonical Ltd1# Copyright (C) 2004, 2005, 2009, 2010 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -17,19 +17,19 @@
17import os17import os
1818
19from bzrlib.errors import BzrCommandError, NoSuchRevision19from bzrlib.errors import BzrCommandError, NoSuchRevision
20from bzrlib.tests.blackbox import ExternalBase20from bzrlib.tests import TestCaseWithTransport
21from bzrlib.workingtree import WorkingTree21from bzrlib.workingtree import WorkingTree
2222
2323
24class TestRevisionInfo(ExternalBase):24class TestRevisionInfo(TestCaseWithTransport):
2525
26 def check_error(self, output, *args):26 def check_output(self, output, *args):
27 """Verify that the expected error matches what bzr says.27 """Verify that the expected output matches what bzr says.
2828
29 The output is supplied first, so that you can supply a variable29 The output is supplied first, so that you can supply a variable
30 number of arguments to bzr.30 number of arguments to bzr.
31 """31 """
32 self.assertContainsRe(self.run_bzr(args, retcode=3)[1], output)32 self.assertEquals(self.run_bzr(*args)[0], output)
3333
34 def test_revision_info(self):34 def test_revision_info(self):
35 """Test that 'bzr revision-info' reports the correct thing."""35 """Test that 'bzr revision-info' reports the correct thing."""
3636
=== modified file 'bzrlib/tests/blackbox/test_rmbranch.py'
--- bzrlib/tests/blackbox/test_rmbranch.py 2010-03-22 10:11:00 +0000
+++ bzrlib/tests/blackbox/test_rmbranch.py 2010-06-15 06:35:41 +0000
@@ -20,12 +20,12 @@
20from bzrlib import (20from bzrlib import (
21 bzrdir,21 bzrdir,
22 )22 )
23from bzrlib.tests.blackbox import (23from bzrlib.tests import (
24 ExternalBase,24 TestCaseWithTransport,
25 )25 )
2626
2727
28class TestRemoveBranch(ExternalBase):28class TestRemoveBranch(TestCaseWithTransport):
2929
30 def example_branch(self, path='.'):30 def example_branch(self, path='.'):
31 tree = self.make_branch_and_tree(path)31 tree = self.make_branch_and_tree(path)
3232
=== modified file 'bzrlib/tests/blackbox/test_switch.py'
--- bzrlib/tests/blackbox/test_switch.py 2010-05-28 14:15:28 +0000
+++ bzrlib/tests/blackbox/test_switch.py 2010-06-15 06:35:41 +0000
@@ -22,11 +22,11 @@
2222
23from bzrlib import osutils23from bzrlib import osutils
24from bzrlib.workingtree import WorkingTree24from bzrlib.workingtree import WorkingTree
25from bzrlib.tests.blackbox import ExternalBase25from bzrlib.tests import TestCaseWithTransport
26from bzrlib.directory_service import directories26from bzrlib.directory_service import directories
2727
2828
29class TestSwitch(ExternalBase):29class TestSwitch(TestCaseWithTransport):
3030
31 def _create_sample_tree(self):31 def _create_sample_tree(self):
32 tree = self.make_branch_and_tree('branch-1')32 tree = self.make_branch_and_tree('branch-1')
3333
=== modified file 'bzrlib/tests/blackbox/test_too_much.py'
--- bzrlib/tests/blackbox/test_too_much.py 2010-02-17 17:11:16 +0000
+++ bzrlib/tests/blackbox/test_too_much.py 2010-06-15 06:35:41 +0000
@@ -46,11 +46,11 @@
46from bzrlib.errors import BzrCommandError46from bzrlib.errors import BzrCommandError
47from bzrlib.tests.http_utils import TestCaseWithWebserver47from bzrlib.tests.http_utils import TestCaseWithWebserver
48from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer48from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
49from bzrlib.tests.blackbox import ExternalBase49from bzrlib.tests import TestCaseWithTransport
50from bzrlib.workingtree import WorkingTree50from bzrlib.workingtree import WorkingTree
5151
5252
53class TestCommands(ExternalBase):53class TestCommands(TestCaseWithTransport):
5454
55 def test_invalid_commands(self):55 def test_invalid_commands(self):
56 self.run_bzr("pants", retcode=3)56 self.run_bzr("pants", retcode=3)
@@ -354,7 +354,7 @@
354 return L354 return L
355355
356356
357class OldTests(ExternalBase):357class OldTests(TestCaseWithTransport):
358 """old tests moved from ./testbzr."""358 """old tests moved from ./testbzr."""
359359
360 def test_bzr(self):360 def test_bzr(self):
361361
=== modified file 'bzrlib/tests/blackbox/test_unknowns.py'
--- bzrlib/tests/blackbox/test_unknowns.py 2010-05-02 20:10:25 +0000
+++ bzrlib/tests/blackbox/test_unknowns.py 2010-06-15 06:35:41 +0000
@@ -18,10 +18,10 @@
1818
19"""Black-box tests for 'bzr unknowns', which shows unknown files."""19"""Black-box tests for 'bzr unknowns', which shows unknown files."""
2020
21from bzrlib.tests.blackbox import ExternalBase21from bzrlib.tests import TestCaseWithTransport
2222
2323
24class TestUnknowns(ExternalBase):24class TestUnknowns(TestCaseWithTransport):
2525
26 def test_unknowns(self):26 def test_unknowns(self):
27 """Test that 'unknown' command reports unknown files"""27 """Test that 'unknown' command reports unknown files"""
2828
=== modified file 'bzrlib/tests/blackbox/test_whoami.py'
--- bzrlib/tests/blackbox/test_whoami.py 2010-06-07 01:16:10 +0000
+++ bzrlib/tests/blackbox/test_whoami.py 2010-06-15 06:35:41 +0000
@@ -20,6 +20,7 @@
20import os20import os
2121
22import bzrlib22import bzrlib
23<<<<<<< TREE
23from bzrlib import (24from bzrlib import (
24 osutils,25 osutils,
25 config,26 config,
@@ -28,6 +29,14 @@
2829
2930
30class TestWhoami(ExternalBase):31class TestWhoami(ExternalBase):
32=======
33from bzrlib import osutils
34from bzrlib.branch import Branch
35from bzrlib.tests import TestCaseWithTransport
36
37
38class TestWhoami(TestCaseWithTransport):
39>>>>>>> MERGE-SOURCE
3140
32 def test_whoami(self):41 def test_whoami(self):
33 # this should always identify something, if only "john@localhost"42 # this should always identify something, if only "john@localhost"