[rfc] [patch] new merge tests suggested by Aaron

John Arbash Meinel john at arbash-meinel.com
Thu Dec 15 17:48:29 GMT 2005


duchier at ps.uni-sb.de wrote:
> Hi Aaron,
> 
> I converted the 5 cases you described yesterday into new additions to
> the test suite.  Could please have a look at these tests to verify
> that I have correctly interpreted your intent.  Bzr of course passes
> with flying colors.
> 


> ------------------------------------------------------------------------
> 
> === modified file 'bzrlib/tests/test_merge_core.py'
> --- bzrlib/tests/test_merge_core.py	
> +++ bzrlib/tests/test_merge_core.py	
> @@ -712,3 +712,134 @@
>          merge(['b', -1],['b', 1],this_dir='a')
>          self.assert_(os.path.exists('a/file'))
>          self.assertEqual(file('a/file').read(),'THAT')
> +
> +    def test_merge_abentley_1(self):
> +        """This case requires that you must not do creates before move-into-place:
> +        
> +        $ touch foo
> +        $ bzr add foo
> +        $ bzr commit
> +        $ bzr mv foo bar
> +        $ touch foo
> +        $ bzr add foo
> +        $ bzr commit"""

Tests should have a short 1 line description, since that will be
displayed when running selftest --verbose.
Perhaps "Test create occurs after move-into-place".

Also, proper formatting is:

"""One line description

some stuff
more stuff
"""

The closing """ should be on a line of its own.

...

This one especially needs some sort of doc comment, so that we don't see
a blank line.

> +    def test_merge_abentley_5(self):
> +        """
> +        $ touch foo
> +        $ bzr add foo
> +        $ bzr commit
> +        $ bzr mkdir bar
> +        $ bzr add bar
> +        $ bzr mv foo foo/bar
> +        $ bzr commit"""
> +        os.mkdir('a')
> +        a = Branch.initialize('a')
> +        file('a/foo', 'wb').write('A/FOO')
> +        a_wt = a.working_tree()
> +        a_wt.add('foo')
> +        a_wt.commit('added foo')
> +        copy_branch(a, 'b')
> +        b = Branch.open('b')
> +        b_wt = b.working_tree()
> +        os.mkdir('b/bar')
> +        b_wt.add('bar')
> +        b_wt.rename_one('foo', 'bar/foo')
> +        b_wt.commit('created dir bar, moved foo into bar')
> +        merge(['b', -1],['b', 1],this_dir='a')

> 
> Cheers,
> 
> --Denys

Other than some minor formatting and documentaion:
+1 on the tests themselves.

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051215/e019aa87/attachment.pgp 


More information about the bazaar mailing list