[MERGE][bug #147986] branch in test root directory can cause confusing results

Martin Pool mbp at canonical.com
Tue Oct 2 12:43:12 BST 2007


bb:approve

Thanks for finding this again.
> +    def test_safety_net(self):
> +        """No test should modify the safety .bzr directory.
> +
> +        We just test that the _check_safety_net private method raises
> +        AssertionError, it's easier than building a test suite with the same
> +        test.
> +        """
> +        # Oops, a commit in the current directory (i.e. without local .bzr
> +        # directory) will crawl up the hierarchy to find a .bzr directory.
> +        self.run_bzr(['commit', '-mfoo', '--unchanged'])
> +        # But we have a safety net in place.
> +        self.assertRaises(AssertionError, self._check_safety_net)
> +

In passing, I think this would be a slightly stronger test if you made a
new test object, ran it, and observed that the error was correctly
raised during cleanup.  But maybe that is too complicated; there's no
need to change it now.

Ultimately I think it would be preferable if we arranged for any attempt
to modify that bzrdir to cause a test failure immediately - maybe by
giving it a special or unknown bzrdir format.

But for now, please do go ahead and merge.

-- 
Martin



More information about the bazaar mailing list