Merge lp:~mbp/bzr/externalbase into lp:bzr
| Status: | Merged |
|---|---|
| Approved by: | Vincent Ladeuil on 2010-06-15 |
| Approved revision: | 5291 |
| 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 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Vincent Ladeuil | 2010-06-15 | Approve on 2010-06-16 | |
|
Review via email:
|
|||
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.
* change subclasses to TestCaseWithTra
* 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)
| 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 TestCaseWithTra
>
> 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.assertCont
> 962 + self.assertEqua
>
> 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
| 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.
| Robert Collins (lifeless) wrote : | # |
This:
195 - self.check_
196 - self.check_
197 - self.check_
198 -
199 - self.check_
200 - self.check_
201 - self.check_
202 -
203 - self.check_
204 - self.check_
205 - self.check_
206 + for i in [1, 2, 3]:
207 + self.assertEqua
208 + self.run_
209 + self.assertEqua
210 + self.run_
211 + self.assertEqua
212 + self.run_
Results in harder to evaluate exceptions. I realise its very unlikely to fail but if it does you'll get something like
'serialised_
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.
| Martin Pool (mbp) wrote : | # |
On 21 June 2010 07:25, Robert Collins <email address hidden> wrote:
> This:
>
> 195 - self.check_
> 196 - self.check_
> 197 - self.check_
> 198 -
> 199 - self.check_
> 200 - self.check_
> 201 - self.check_
> 202 -
> 203 - self.check_
> 204 - self.check_
> 205 - self.check_
> 206 + for i in [1, 2, 3]:
> 207 + self.assertEqu
> 208 + self.run_
> 209 + self.assertEqu
> 210 + self.run_
> 211 + self.assertEqu
> 212 + self.run_
>
> Results in harder to evaluate exceptions. I realise its very unlikely to fail but if it does you'll get something like
> 'serialised_
>
> 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
| 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 .
| 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
| 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

Yeah ! I was stealth-ly working toward the same goal :)
Since you're there, how about replacing 'from bzrlib.tests import TestCaseWithTra nsport ... (TestCaseWithTr ansport) ' by 'from bzrlib import tests.... (tests. TestCaseWithTra nsport) ' ? :-p
953 - def check_error(self, output, *args): ainsRe( self.run_ bzr(args, retcode=3)[1], output) ls(self. run_bzr( *args)[ 0], output)
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.assertCont
962 + self.assertEqua
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.