summaryrefslogtreecommitdiff
path: root/tests/select_for_update
diff options
context:
space:
mode:
authorMads Jensen <mje@inducks.org>2017-05-28 21:37:21 +0200
committerTim Graham <timograham@gmail.com>2017-07-29 19:07:23 -0400
commita51c4de1945be2225f20fad794cfb52d8f1f9236 (patch)
tree36386b70a27cf027a8a491de319c3e59e0d3d0cd /tests/select_for_update
parent38988f289f7f5708f5ea85de2d5dfe0d86b23106 (diff)
downloaddjango-a51c4de1945be2225f20fad794cfb52d8f1f9236.tar.gz
Used assertRaisesMessage() to test Django's error messages.
Diffstat (limited to 'tests/select_for_update')
-rw-r--r--tests/select_for_update/tests.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/select_for_update/tests.py b/tests/select_for_update/tests.py
index 7228af6e8e..eaedd506de 100644
--- a/tests/select_for_update/tests.py
+++ b/tests/select_for_update/tests.py
@@ -246,7 +246,8 @@ class SelectForUpdateTests(TransactionTestCase):
A TransactionManagementError is raised
when a select_for_update query is executed outside of a transaction.
"""
- with self.assertRaises(transaction.TransactionManagementError):
+ msg = 'select_for_update cannot be used outside of a transaction.'
+ with self.assertRaisesMessage(transaction.TransactionManagementError, msg):
list(Person.objects.all().select_for_update())
@skipUnlessDBFeature('has_select_for_update')
@@ -257,7 +258,8 @@ class SelectForUpdateTests(TransactionTestCase):
only when the query is executed.
"""
people = Person.objects.all().select_for_update()
- with self.assertRaises(transaction.TransactionManagementError):
+ msg = 'select_for_update cannot be used outside of a transaction.'
+ with self.assertRaisesMessage(transaction.TransactionManagementError, msg):
list(people)
@skipUnlessDBFeature('supports_select_for_update_with_limit')