#30927: Simplify example of test of deprecation warning.
-----------------------------------------+------------------------
Reporter: André Ericson | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
When adding deprecation warnings it's very likely that the documentation
(https://docs.djangoproject.com/en/2.2/internals/contributing/writing-code
/submitting-patches/#deprecating-a-feature) will be followed and the
example of the test for the assertion will be copied.
{{{
import warnings
def test_foo_deprecation_warning(self):
with warnings.catch_warnings(record=True) as warns:
warnings.simplefilter('always') # prevent warnings from appearing
as errors
# invoke deprecated behavior
self.assertEqual(len(warns), 1)
msg = str(warns[0].message)
self.assertEqual(msg, 'Expected deprecation message')
}}}
This could be simplified as suggested here:
https://github.com/django/django/pull/11905#discussion_r334984986
My suggestion is that we change the documentation to avoid unnecessary
extra work.
--
Ticket URL: <https://code.djangoproject.com/ticket/30927>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.4f2cbeef89f2abb46672def5e54936ea%40djangoproject.com.