summaryrefslogtreecommitdiff
path: root/docs/internals
diff options
context:
space:
mode:
Diffstat (limited to 'docs/internals')
-rw-r--r--docs/internals/contributing/writing-code/submitting-patches.txt4
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/internals/contributing/writing-code/submitting-patches.txt b/docs/internals/contributing/writing-code/submitting-patches.txt
index 2d61c6235e..c63cc6f9f0 100644
--- a/docs/internals/contributing/writing-code/submitting-patches.txt
+++ b/docs/internals/contributing/writing-code/submitting-patches.txt
@@ -206,9 +206,10 @@ You should also add a test for the deprecation warning::
def test_foo_deprecation_warning(self):
msg = "Expected deprecation message"
- with self.assertWarnsMessage(RemovedInDjangoXXWarning, msg):
+ with self.assertWarnsMessage(RemovedInDjangoXXWarning, msg) as ctx:
# invoke deprecated behavior
...
+ self.assertEqual(ctx.filename, __file__)
It's important to include a ``RemovedInDjangoXXWarning`` comment above code
which has no warning reference, but will need to be changed or removed when the
@@ -230,6 +231,7 @@ deprecation ends. For example::
warnings.warn(
"foo() is deprecated.",
category=RemovedInDjangoXXWarning,
+ stacklevel=2,
)
old_private_helper()
...