Hello,
When a feature is deprecated, it raises a PendingDeprecationWarning, either at
import time or at run time. After the following release it raises
DeprecationWarning. Assuming we have a good test coverage, these warnings will
be shown by the test suite, with -Wall for PendingDeprecationWarning, by
default for DeprecationWarning. This is annoying. The output of the test suite
should remain clean.
Unfortunately, I've noticed that we often forget to silence warnings when we
deprecate a feature. For instance, right new, the test suite raises warnings
related to custom SQL, syncdb, and SortedDict (with -Wall). If you committed
one of these deprecations, would you mind silencing the
PendingDeprecationWarnings in the tests?
There are two ways to achieve that:
1) In a particular test
def test_foo(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
# frobnicate deprecated stuff
# go ahead with the test
2) For an entire test case
django.test.utils contains three helpful mixins if you want to silence warnings
throughout a TestCase: IgnorePendingDeprecationWarningsMixin,
IgnoreDeprecationWarningsMixin, and IgnoreAllDeprecationWarningsMixin.
Thank you,
--
Aymeric.
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.