Test suite silences warnings
|Reported by:||lukeplant||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The documentation encourages use of python -Wall manage.py test to find PendingDeprecationWarning. However, Django's test suite in many places silences warnings (e.g. DeprecationWarning), and then 'restores' the state of warning filters to something other than what it was originally. So, for example, if you do:
python -Wall manage.py test auth myapp
the warnings from myapp will not be shown as they ought.
Also, many warnings that Django's test suite itself emits are silenced by the current way of handling warnings - such as all the PendingDeprecationWarnings emitted by unittest2.failUnless etc., and some from cgi, depending on which tests are run and in what order.
Two things need to be done:
- Correctly save and restore the original filters. warnings.catch_warnings from Python 2.5 and greater shows how to do this.
- Use more specific filters so that only warnings generated by Django are silenced, not those generated by unittest2. This is slightly tricky, since we are bundling unittest2 in the Django namespace.
Change History (5)
comment:1 Changed 3 years ago by lukeplant
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:4 Changed 3 years ago by lukeplant
- Resolution set to fixed
- Status changed from new to closed