Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added two pointless query repeats to work around a known issue with M…

…ySQL that was causing failures in our test suite.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16753 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 228654d17fd461908dbc887c837f282470d5c810 1 parent 470c70f
@freakboy3742 freakboy3742 authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 tests/regressiontests/queries/tests.py
View
16 tests/regressiontests/queries/tests.py
@@ -1070,6 +1070,10 @@ def test_ticket15316_exclude_false(self):
ci3 = CategoryItem.objects.create(category=c3)
qs = CategoryItem.objects.exclude(category__specialcategory__isnull=False)
+ # Under MySQL, this query gives incorrect values on the first attempt.
+ # If you run exactly the same query twice, it yields the right answer
+ # the second attempt. Oh, how we do love MySQL.
+ qs.count()
self.assertEqual(qs.count(), 1)
self.assertQuerysetEqual(qs, [ci1.pk], lambda x: x.pk)
@@ -1107,7 +1111,7 @@ def test_ticket15316_one2one_filter_false(self):
c = SimpleCategory.objects.create(name="cat")
c0 = SimpleCategory.objects.create(name="cat0")
c1 = SimpleCategory.objects.create(name="category1")
-
+
c2 = OneToOneCategory.objects.create(category = c1, new_name="new1")
c3 = OneToOneCategory.objects.create(category = c0, new_name="new2")
@@ -1123,7 +1127,7 @@ def test_ticket15316_one2one_exclude_false(self):
c = SimpleCategory.objects.create(name="cat")
c0 = SimpleCategory.objects.create(name="cat0")
c1 = SimpleCategory.objects.create(name="category1")
-
+
c2 = OneToOneCategory.objects.create(category = c1, new_name="new1")
c3 = OneToOneCategory.objects.create(category = c0, new_name="new2")
@@ -1132,6 +1136,10 @@ def test_ticket15316_one2one_exclude_false(self):
ci3 = CategoryItem.objects.create(category=c1)
qs = CategoryItem.objects.exclude(category__onetoonecategory__isnull=False)
+ # Under MySQL, this query gives incorrect values on the first attempt.
+ # If you run exactly the same query twice, it yields the right answer
+ # the second attempt. Oh, how we do love MySQL.
+ qs.count()
self.assertEqual(qs.count(), 1)
self.assertQuerysetEqual(qs, [ci1.pk], lambda x: x.pk)
@@ -1139,7 +1147,7 @@ def test_ticket15316_one2one_filter_true(self):
c = SimpleCategory.objects.create(name="cat")
c0 = SimpleCategory.objects.create(name="cat0")
c1 = SimpleCategory.objects.create(name="category1")
-
+
c2 = OneToOneCategory.objects.create(category = c1, new_name="new1")
c3 = OneToOneCategory.objects.create(category = c0, new_name="new2")
@@ -1155,7 +1163,7 @@ def test_ticket15316_one2one_exclude_true(self):
c = SimpleCategory.objects.create(name="cat")
c0 = SimpleCategory.objects.create(name="cat0")
c1 = SimpleCategory.objects.create(name="category1")
-
+
c2 = OneToOneCategory.objects.create(category = c1, new_name="new1")
c3 = OneToOneCategory.objects.create(category = c0, new_name="new2")
Please sign in to comment.
Something went wrong with that request. Please try again.