[MERGE] Treat assert statements in our code as a hard error

Martin Pool mbp at sourcefrog.net
Thu Apr 24 08:50:56 BST 2008


Per the previous rfc, here is a long patch that removes all assert statements
from bzrlib.

It's not quite mechanical because I tried to make a reasonable judgement about
what to do with each of them.  Some should always be done with an if/raise, some 
should be done as unittest assertions, and some are look-before-you-leap or
unlikely to ever fail.

The changes were pretty focussed on just the assertions with a few exceptions:

 * Removed deprecated InventoryEntry.diff

 * Changed test_patches to use bzrlib.unittest rather than Python unittest

The test for not using assert uses the python parser to read all our files.  It
is a bit slow, taking 12s on my machine to load and search them.  We could use
a less precise but faster regexp, but I think the cost is reasonable to avoid
false negatives or positives.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-patch
Size: 249816 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080424/af0cda47/attachment-0002.bin 


More information about the bazaar mailing list