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

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Oct 3 08:42:08 BST 2007


>>>>> "martin" == Martin Pool <mbp at canonical.com> writes:

    martin> bb:approve
    martin> 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)
    >> +

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

That's what I referred to in the doc string, yes, couldn't find
the easy to do it, so I punted.

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

chmod -R -w maybe ?

    martin> But for now, please do go ahead and merge.

Hehe, the funny thing is that I can't, because one of my own
tests is buggy :-)

http://bundlebuggy.aaronbentley.com/request/%3Cm24phkujs6.fsf@free.fr%3E

fixes that bug and should be merged before *this* patch can.

      Vincent



More information about the bazaar mailing list