[merge] cleanup remerge tests

Martin Pool mbp at canonical.com
Fri Jun 30 03:31:36 BST 2006


On 29 Jun 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> The attached bundle has one small bugfix, and a bunch of test cleanup.
> 
> While trying to fix win32, I found that the remerge test was failing.
> While looking deeper, I found out that the part that was succeeding was
> actually an accident. We were getting retcode=3 because of the wrong reason.
> 
> So I went ahead and updated the remerge tests, moving them into their
> own file, and writing run_bzr_error to make it nicer to verify we are
> getting the error we expect.
> 
> I haven't fixed anything to actually work on win32 yet, but I figured
> this cleanup is good enough to be merged by itself.
> 
> I also found one small bug with an error message that was missing a space.

That looks good; just one comment

> === modified file bzrlib/tests/__init__.py
> --- bzrlib/tests/__init__.py
> +++ bzrlib/tests/__init__.py
> @@ -739,6 +739,12 @@
>              encoding = bzrlib.user_encoding
>          return self.run_bzr(*args, **kwargs)[0].decode(encoding)
>  
> +    def run_bzr_error(self, error_regexes, *args, **kwargs):
> +        """Run bzr, and check that stderr contains the supplied regexes"""
> +        out, err = self.run_bzr(*args, **kwargs)
> +        for regex in error_regexes:
> +            self.assertContainsRe(err, regex)
> +

Maybe the docstring could be expanded a bit because the varargs are
somewhat unclear:

  :param error_regexes: Sequence of regular expressions which must 
      each individually be found in the output.  The relative ordering
      of them is not enforced.
  :param args: List of command line arguments for bzr.
  :param retcode: May be given as a keyword argument to set the expected
      return code; the default is 0.

Or perhaps people should just grep for examples?

-- 
Martin




More information about the bazaar mailing list