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
This commit is contained in:
Russell Keith-Magee 2011-09-10 17:29:33 +00:00
parent fee2d1877f
commit eb297583b1
1 changed files with 5 additions and 0 deletions

View File

@ -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)