diff --git a/tests/modeltests/select_for_update/tests.py b/tests/modeltests/select_for_update/tests.py index 24e6d748e785f..643b0852d6b5b 100644 --- a/tests/modeltests/select_for_update/tests.py +++ b/tests/modeltests/select_for_update/tests.py @@ -205,6 +205,11 @@ def test_block(self): # 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)