summaryrefslogtreecommitdiff
path: root/tests/select_for_update/tests.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2016-08-08 12:28:37 -0400
committerSimon Charette <charette.s@gmail.com>2016-08-08 13:03:19 -0400
commit29a3f8b4bb1c4174a2b63766018b9106593b8ab6 (patch)
tree6ac17b6c5d9c3c1b231be63303ee46c31400fd01 /tests/select_for_update/tests.py
parent887f3d3219b9f8192d27314eceee27ab1f89c5cc (diff)
Refs #22343 -- Corrected a test for missing select_for_update(nowait=True) support.
Diffstat (limited to 'tests/select_for_update/tests.py')
-rw-r--r--tests/select_for_update/tests.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/select_for_update/tests.py b/tests/select_for_update/tests.py
index 55ead7ef8f..dcdd742ad4 100644
--- a/tests/select_for_update/tests.py
+++ b/tests/select_for_update/tests.py
@@ -132,12 +132,12 @@ class SelectForUpdateTests(TransactionTestCase):
@skipUnlessDBFeature('has_select_for_update')
def test_unsupported_nowait_raises_error(self):
"""
- If a SELECT...FOR UPDATE NOWAIT is run on a database backend
- that supports FOR UPDATE but not NOWAIT, then we should find
- that a DatabaseError is raised.
+ DatabaseError is raised if a SELECT...FOR UPDATE NOWAIT is run on
+ a database backend that supports FOR UPDATE but not NOWAIT.
"""
- with self.assertRaises(DatabaseError):
- list(Person.objects.all().select_for_update(nowait=True))
+ with self.assertRaisesMessage(DatabaseError, 'NOWAIT is not supported on this database backend.'):
+ with transaction.atomic():
+ Person.objects.select_for_update(nowait=True).get()
@skipIfDBFeature('has_select_for_update_skip_locked')
@skipUnlessDBFeature('has_select_for_update')