Author: russellm
Date: 2011-09-10 10:29:33 -0700 (Sat, 10 Sep 2011)
New Revision: 16781
Modified:
django/trunk/tests/modeltests/select_for_update/tests.py
Log:
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.
Modified: django/trunk/tests/modeltests/select_for_update/tests.py
===================================================================
--- django/trunk/tests/modeltests/select_for_update/tests.py 2011-09-10
17:20:31 UTC (rev 16780)
+++ django/trunk/tests/modeltests/select_for_update/tests.py 2011-09-10
17:29:33 UTC (rev 16781)
@@ -205,6 +205,11 @@
# 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)
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.