[rfc] cleaning up run_bzr and similar things in the test suite

John Arbash Meinel john at arbash-meinel.com
Tue Jun 26 14:34:30 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> Marius, and other people reviewing his work, reminded me that the ways
> by which the test suite exercises the bzr command line are currently a
> bit messy.  I am now cleaning them up and wanted to just give some
> advance warning and let people object if they will.
> 
> One question is how arguments should be passed:
> 
>  1- run_bzr("add a b")
>  2- run_bzr(["add", "a", "b"])
>  3- run_bzr("add", "a", "b")
> 
> 1 has the advantage that it's much easier to read and write but the
> problem that it needs to be split.  2 is more reliable and avoids
> quoting problems if you need to pass arguments containing
> metacharacters, or which might do so, or if you need to mix in
> variables, and is closer to the real interface of commands.py.  3
> seems like an inferior compromise between the two.
> 
> Having looked at several of these I really prefer #1 in cases where
> it's safe to use, and I would be happy to see it in new code. I'm
> going to get rid of #3 when I see it.  Robert asks that it be at least
> fairly explicit when and where the splitting is done.
> 
> But the main problem is just a multiplication of similar interfaces.
> 

I actually prefer 3 to 2 because it is less typing for the same gain. I *think*
you'll find it the most common.

Don't forget there is "runbzr()" from ExternalBase.

Mostly I pick 3 because I don't think it ever split automatically (except in
Marius's TestCase), so it was just as explicit as 2 without having to hit the
[] characters.

Overall, 1 is quite a bit easier to type, and I guess 2 is only marginally
harder than 3.

If you are getting into it, you should also be aware of all of the
run_bzr_captured(), run_bzr(), capture(), ... I think there are a few more. All
are fairly subtly different, and their differences should probably be unified.

I'm happy to conform to whatever standard we decide. But I thought I would make
mention that I've been using 3 for quite some time.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGgRXmJdeBCYSNAAMRAqCIAKDLxjqsvG7zPgr3kUhEI4ppYgXi1ACfXcaG
cAwByLsnkqOen6Z0HFvlsO0=
=n2vC
-----END PGP SIGNATURE-----



More information about the bazaar mailing list