[MERGE] "Branch.open()" should re-use the connection for stacked branches

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Jan 8 20:54:21 GMT 2009


>>>>> "jam" == John Arbash Meinel <john at arbash-meinel.com> writes:

<snip/>
    jam> === modified file 'bzrlib/tests/branch_implementations/test_stacking.py'
    jam> --- bzrlib/tests/branch_implementations/test_stacking.py	2008-12-01 23:50:52 +0000
    jam> +++ bzrlib/tests/branch_implementations/test_stacking.py	2009-01-08 19:15:20 +0000
    jam> @@ -23,11 +23,17 @@

<snip/>
 
 
    jam> +old_format_errors = (
    jam> +    errors.UnstackableBranchFormat,
    jam> +    errors.UnstackableRepositoryFormat,
    jam> +    )
    jam> +
    jam> +

Hmm, 'old' and 'new' tends to bit-rot quite quickly, how about
unstackable_format_errors ? I know you just factored that out
but...
 
<snip/>

    jam> +class TestStackingConnections(
    jam> +    transport_util.TestCaseWithConnectionHookedTransport):
    jam> +
    jam> +    def setUp(self):
    jam> +        super(TestStackingConnections, self).setUp()
    jam> +        try:
    jam> +            base_tree = self.make_branch_and_tree('base',
    jam> +                                                  format=self.bzrdir_format)
    jam> +        except errors.UninitializableFormat, e:
    jam> +            raise TestNotApplicable(e)
    jam> +        stacked = self.make_branch('stacked', format=self.bzrdir_format)
    jam> +        try:
    jam> +            stacked.set_stacked_on_url(base_tree.branch.base)
    jam> +        except old_format_errors, e:
    jam> +            raise TestNotApplicable(e)

If I remember correctly, raising TestNotApplicable during setUp
is bad because tearDown is not called ? It may not matter that
much here but I think it's better to avoid that idiom.

Defining a helper should solve that problem but forces you to
call it in every test.

BB:tweak

        Vincent



More information about the bazaar mailing list