[MERGE] cleanup blackbox tests
John Arbash Meinel
john at arbash-meinel.com
Wed Jun 27 15:36:37 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> On 6/27/07, Martin Pool <mbp at sourcefrog.net> wrote:
>
>> It's also good when we need to build up a command from constituent
>> parts - I would say it's safer never to be doing a string join but
>> always a list join:
>>
>> not run_bzr("commit " + filename)
>> but run_bzr(["commit", filename])
>
> OK, I see that's what you're still doing.
>
>> > Note: using commit messages without embedded spaces is the most
>> > useful trick-of-the-day :-)
>>
>> I don't think we should change them to not use spaces in the test case
>> as part of this patch, if that's what you're doing. If you just mean
>> that when you're interactively committing you can leave off the quotes
>> then yes, that's true.
>
> OK, I see you did do that in the tests. Personally I might have left
> them as lists or escaped the space with a backslash. But we're not
> actually testing the parameter in those cases, so I don't object.
>
> @@ -88,23 +88,23 @@
> def test_remove_tree_lightweight_checkout_explicit(self):
> self.tree.branch.create_checkout('branch2', lightweight=True)
> self.failUnlessExists('branch2/foo')
> - output = self.run_bzr(
> - ["Cannot remove working tree from lightweight checkout"],
> - 'remove-tree', 'branch2', retcode=3)
> + output = self.run_bzr_error(
> + ["You cannot remove the working tree from a lightweight
> checkout"],
> + 'remove-tree branch2', retcode=3)
> self.failUnlessExists('branch2/foo')
> self.failUnlessExists('branch1/foo')
>
> (In passing) I don't understand how the old code ever worked - it's
> passing the expected error first but run_bzr expects it to be a kwarg.
> Well, it's a good reason to clean it up.
>
> I'll merge mine now as John reviewed it, and give other people a
> chance to comment on Vincent's changes.
>
I think Vila has it correct. doing:
bzr "cannot remove working tree from lightweight checkout"; echo $?
does indeed fail with error code 3 because of:
bzr: ERROR: unknown command "cannot remove working tree from lightweight checkout"
3
Which, if anything, indicates we should have more fine-grained error codes. For
example, we could make "unknown command" be error code 4 instead of 3.
Or we could have error codes be the 8-bit checksum of the error class. But that
would just be weird :)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGgnX0JdeBCYSNAAMRAq+KAJ9YjQ7+/AEYPOcQeODiyA6liTgw8QCgtxOJ
javBZ5zhyOpLKPMYQUPfWqI=
=/j1g
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list