[MERGE] Support old API properly

John Arbash Meinel john at arbash-meinel.com
Wed Aug 16 21:23:20 BST 2006


Aaron Bentley wrote:
> Hi all,
> 
> My last work on making roots less weird introduced a regression.  It was
> meant to make the old API deprecated, but instead, made an assertion
> fail.  Unfortunately, that case wasn't exercised by the test suite, so I
> missed it.
> 
> This patch addresses that case, and introduces a test case to cover it.
>  That test case emits a deprecation warning, but I don't see any
> alternative, because the deprecated API is what I'm testing.
> 
> Aaron

When testing deprecated APIs, the way I test them is to have them not
directly import warnings.warn or symbol_versioning.warn. Instead to
import symbol_versioning.

After that, there is the helper function:
symbol_versioning.set_warning_method()

This lets you override the default warning method with a collector. And
then you have the opportunity to both assert that the deprecation is
being emitted *and* that it does the right thing.

I highly recommend it. (Plus it means the test suite doesn't create
stipple).

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/20060816/4df0555e/attachment.pgp 


More information about the bazaar mailing list