summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2024-08-09 12:55:40 -0400
committerNatalia <124304+nessita@users.noreply.github.com>2024-08-28 11:46:49 -0300
commitdd58edcc373afe57a56bf7c2374a4fc8446e80e9 (patch)
treefe9d42a4d476ec4045f77202823fe6edc2f51312 /tests
parent8f5d2c374a150fca063443292cdf2618026bda42 (diff)
[5.1.x] Refs #35405 -- Adjusted deprecation warning stacklevel in FieldCacheMixin.get_cache_name().
Backport of 39abd56a7fb1e2f735040df0fdfc08f57d91a49b from main.
Diffstat (limited to 'tests')
-rw-r--r--tests/model_fields/test_mixins.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/model_fields/test_mixins.py b/tests/model_fields/test_mixins.py
index 5ccfac4d78..8847f25987 100644
--- a/tests/model_fields/test_mixins.py
+++ b/tests/model_fields/test_mixins.py
@@ -34,9 +34,10 @@ class FieldCacheMixinTests(SimpleTestCase):
# RemovedInDjango60Warning.
def test_get_cache_name_deprecated(self):
msg = "Override ExampleOld.cache_name instead of get_cache_name()."
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
+ with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
result = ExampleOld().cache_name
self.assertEqual(result, "example")
+ self.assertEqual(ctx.filename, __file__)
def test_cache_name(self):
result = Example().cache_name