summaryrefslogtreecommitdiff
path: root/tests/many_to_many
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2024-08-09 13:03:24 -0400
committernessita <124304+nessita@users.noreply.github.com>2024-08-28 11:44:05 -0300
commit57307bbc7d88927989cf5b314f16d6e13ade04e6 (patch)
tree2f110306223f71903fbe38a35bedeb898d38677a /tests/many_to_many
parent39abd56a7fb1e2f735040df0fdfc08f57d91a49b (diff)
Fixed #35666 -- Documented stacklevel usage and testing, and adjusted test suite accordingly.
Over the years we've had multiple instances of hit and misses when emitting warnings: either setting the wrong stacklevel or not setting it at all. This work adds assertions for the existing warnings that were declaring the correct stacklevel, but were lacking tests for it.
Diffstat (limited to 'tests/many_to_many')
-rw-r--r--tests/many_to_many/tests.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/many_to_many/tests.py b/tests/many_to_many/tests.py
index 351e4eb8cc..c17ed0258c 100644
--- a/tests/many_to_many/tests.py
+++ b/tests/many_to_many/tests.py
@@ -583,8 +583,9 @@ class ManyToManyTests(TestCase):
"get_prefetch_queryset() is deprecated. Use get_prefetch_querysets() "
"instead."
)
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
+ with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
self.a1.publications.get_prefetch_queryset(articles)
+ self.assertEqual(ctx.filename, __file__)
def test_get_prefetch_querysets_invalid_querysets_length(self):
articles = Article.objects.all()