summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2011-09-10 17:29:33 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2011-09-10 17:29:33 +0000
commiteb297583b1b78403cda501133a52e71dd0381576 (patch)
treed0febefd3b61de81494c41d5dee158eca74c7b53
parentfee2d1877f883ccd1aeb70e5a5776e573ef765b7 (diff)
Refs #16490 - Add a commit to ensure that a fresh read is provided; this is only a problem for databases in REPEATABLE READ mode, which is MySQL InnoDB's default. Thanks to Jim Dalton for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16781 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--tests/modeltests/select_for_update/tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/modeltests/select_for_update/tests.py b/tests/modeltests/select_for_update/tests.py
index 24e6d748e7..643b0852d6 100644
--- a/tests/modeltests/select_for_update/tests.py
+++ b/tests/modeltests/select_for_update/tests.py
@@ -205,6 +205,11 @@ class SelectForUpdateTests(TransactionTestCase):
# Check the thread has finished. Assuming it has, we should
# find that it has updated the person's name.
self.failIf(thread.isAlive())
+
+ # We must commit the transaction to ensure that MySQL gets a fresh read,
+ # since by default it runs in REPEATABLE READ mode
+ transaction.commit()
+
p = Person.objects.get(pk=self.person.pk)
self.assertEqual('Fred', p.name)