[MERGE] don't report malformed bundles as NotABundle

John Arbash Meinel john at arbash-meinel.com
Wed Jun 21 21:45:26 BST 2006


Aaron Bentley wrote:
> John Arbash Meinel wrote:
>>> I do understand why you are checking against NotABundle.
>>> My concern is just that assertNotRaises isn't a very good test function.
> 
> It seemed like good symmetry to me.  For most assertions, there's a
> positive test and a negative test.
> 
>>> Because it basically hides errors. In general when testing failure
>>> modes, we want to make sure we fail in the way we expect. If we start
>>> failing in a different way, then we should know about it, and possibly
>>> just fix the test case.
> 
> I agree that it's a rare case where we really only care that a
> particular assertion is not raised.  On the other hand, doing a
> try/except for NotABundle felt wrong; only test framework code should be
> raising assertion errors.
> 
> Perhaps we could have come up with assertMaybeRaises().
> 
>>> I think doing an inline try/except where you explicitly fail if it is
>>> NotABundle, succeed if it is a subclass of BadBundle, and otherwise
>>> fail. And then add a comment to the BadBundle part, making an explicit
>>> note that "It is important that NotABundle not be raised, but the
>>> exception may not be BadBundle", or something like that.
>>> Grabbing any exception also breaks 'KeyboardInterrupt', which we don't
>>> want to grab.
> 
> In general, but the odds of being generating a KeyboardInterrupt in
> there are pretty small.
> 
> Here is the revised version.  It just suppresses BadBundle, and lets
> everything else through, including NotABundle, so the test will error out.
> 
> Aaron

+1 from me.
We disagreed enough that we should probably wait for someone else to
comment.

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060621/e1dc7774/attachment.pgp 


More information about the bazaar mailing list