summaryrefslogtreecommitdiff
path: root/tests/update_only_fields
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2024-08-09 13:41:18 -0400
committerNatalia <124304+nessita@users.noreply.github.com>2024-08-28 11:45:35 -0300
commitc87007ab60f69df7f991e5e6fe113dbaaba94787 (patch)
tree18dc9c294a861739d5ebbfd9536bde18e73340d1 /tests/update_only_fields
parente435b44be6028f10585a4781646da33dc63a0f5c (diff)
[5.1.x] Refs #35060 -- Adjusted deprecation warning stacklevel in Model.save()/asave().
Backport of 52ed2b645e1dd8c9a874cfd21c4c9f2500032626 from main.
Diffstat (limited to 'tests/update_only_fields')
-rw-r--r--tests/update_only_fields/tests.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/update_only_fields/tests.py b/tests/update_only_fields/tests.py
index 816112bc33..a6a5b7cb8e 100644
--- a/tests/update_only_fields/tests.py
+++ b/tests/update_only_fields/tests.py
@@ -262,10 +262,11 @@ class UpdateOnlyFieldsTests(TestCase):
msg = "Passing positional arguments to save() is deprecated"
with (
- self.assertWarnsMessage(RemovedInDjango60Warning, msg),
+ self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx,
self.assertNumQueries(0),
):
s.save(False, False, None, [])
+ self.assertEqual(ctx.filename, __file__)
async def test_empty_update_fields_positional_asave(self):
s = await Person.objects.acreate(name="Sara", gender="F")
@@ -273,8 +274,9 @@ class UpdateOnlyFieldsTests(TestCase):
s.name = "Other"
msg = "Passing positional arguments to asave() is deprecated"
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
+ with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
await s.asave(False, False, None, [])
+ self.assertEqual(ctx.filename, __file__)
# No save occurred for an empty update_fields.
await s.arefresh_from_db()