[MERGE REVIEW] repository UI mark II

Robert Collins robertc at robertcollins.net
Sun Mar 19 12:37:30 GMT 2006


Looks good at first read... modulo one thing

On Sat, 2006-03-18 at 18:12 -0500, Aaron Bentley wrote:

PEP8 - blank line after class before first method - i.e.
class Foo:

    def bar(self):
...


> +class TestSharedRepo(TestCaseInTempDir):
> +    def test_make_repository(self):
> +        self.run_bzr("init-repository", "a")

I think you should capture the output and check it looks right:
          out, err = self.run_bzr("init-repository", "a")
          self.assertEqual("Created repository at ...", out)
          self.assertEqual("". err)

          (or whatever it should be).

> +        self.assertIs(os.path.exists("a/.bzr/repository"), True)
> +        self.assertIs(os.path.exists("a/.bzr/branch"), False)
> +        self.assertIs(os.path.exists("a/.bzr/checkout"), False)

I think the following reads more clearly:
          self.assertTrue(os.path.exists('a/.bzr/repository'))
          self.assertFalse(os.path.exists('a/.bzr/branch'))
          self.assertFalse(os.path.exists('a/.bzr/checkout'))

but if the intent is to test that a shared repository is created with no
branch or checkout, the following might be more appropriate - given we
are not trying to test layout here, rather ui operation:
        dir = bzrlib.bzrdir.BzrDir.open('a')
        self.assertTrue(b.open_repository().is_shared())
        self.assertRaises(errors.NotBranchError, dir.open_branch)
        self.assertRaises(errors.NoWorkingTree, dir.open_workingtree)

That will continue to operate correctly even if we change the disk
layout in the future, reducing test churn.


Other than that its +1 from me. I think that init-repository as the
command <may> need tweaking but thats up to Martin - I have no strong
opinion.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060319/1e64668a/attachment.pgp 


More information about the bazaar mailing list