[MERGE] fix formatting of ImmortalPendingDeletion error message.

Martin Pool mbp at sourcefrog.net
Fri Nov 16 05:12:11 GMT 2007


On Nov 14, 2007 7:46 AM, Robert Collins <robertc at robertcollins.net> wrote:

> About the helper in more detail.. it seems more useful when one is not
> routinely testing the way exceptions are formatted (which we do), and do
> not have a modified assertRaises which returns the exception (which we
> do).
>
> In bzr if you needed to check the formatting today you can already do
>
>  e = self.assertRaises(Error, thingthaterrors)
>  self.assertEqual("foo", str(e))
>
> which seems a whole lot simpler than this Ned's function to me. (And in
> fact the helper you cloned really should be only 2 lines long if we were
> to accept it). But I don't see a need for it.

I do think it's worth checking the string presentation of the error
that was actually raised (using the result of assertRaises), because
it is possible to have the error raised incorrectly.  If one person
adds the error class and a formatting test for it, another person may
later use that exception with parameters that let it be constructed,
but that don't look right when it's printed.  We have had cases of
this.

(It's true if this is done often then the error format will be
repeated, and then it might just be worth looking at attributes of the
exception.)

-- 
Martin



More information about the bazaar mailing list