Merge lp:~divmod-dev/divmod.org/1209082-remove-bogus-performance-tests into lp:divmod.org

Proposed by Tristan Seligmann
Status: Merged
Merged at revision: 2715
Proposed branch: lp:~divmod-dev/divmod.org/1209082-remove-bogus-performance-tests
Merge into: lp:divmod.org
Diff against target: 159 lines (+10/-79)
1 file modified
Axiom/axiom/test/test_query.py (+10/-79)
To merge this branch: bzr merge lp:~divmod-dev/divmod.org/1209082-remove-bogus-performance-tests
Reviewer Review Type Date Requested Status
Laurens Van Houtven Approve
Review via email: mp+178882@code.launchpad.net

Commit message

Remove performance tests that relied on the ordering of tables to influence the query planner.

To post a comment you must log in.
Revision history for this message
Laurens Van Houtven (lvh) wrote :

I think that the discussion resulted in the conclusion that these particular tests are untenable, and removing them is the appropriate way forward. (Specifically, we can't make them pass on all SQLites we support, because Py2.6 and Py2.7 sqlite3 modules have different behavior...). Please merge.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Axiom/axiom/test/test_query.py'
2--- Axiom/axiom/test/test_query.py 2009-01-01 00:28:15 +0000
3+++ Axiom/axiom/test/test_query.py 2013-08-07 05:25:33 +0000
4@@ -1,12 +1,11 @@
5
6 import operator, random
7
8-from twisted.trial.unittest import TestCase, SkipTest
9+from twisted.trial.unittest import TestCase
10
11 from axiom.iaxiom import IComparison, IColumn
12 from axiom.store import Store, ItemQuery, MultipleItemQuery
13 from axiom.item import Item, Placeholder
14-from axiom.test.util import QueryCounter
15
16 from axiom import errors
17 from axiom.attributes import (
18@@ -309,9 +308,9 @@
19 self.assertEquals(s.query(E).count(), 0)
20 self.assertEquals(s.query(E).getColumn("amount").sum(), 0)
21
22- e1 = E(store=s, name=u'widgets', amount=37)
23- e2 = E(store=s, name=u'widgets', amount=63)
24- e3 = E(store=s, name=u'quatloos', amount=99, transaction=u'yes')
25+ E(store=s, name=u'widgets', amount=37)
26+ E(store=s, name=u'widgets', amount=63)
27+ E(store=s, name=u'quatloos', amount=99, transaction=u'yes')
28 s.checkpoint()
29 q = s.count(E, E.name == u'widgets')
30 self.failUnlessEqual(q, 2)
31@@ -663,8 +662,8 @@
32 for i in range(3):
33 c = C(store=s, name=u"C.%s" % i)
34 b = B(store=s, name=u"B.%s" % i, cref=c)
35- a = A(store=s, type=u"A.%s" % i, reftoc=b)
36- a = A(store=s, type=u"A.%s" % i, reftoc=b)
37+ A(store=s, type=u"A.%s" % i, reftoc=b)
38+ A(store=s, type=u"A.%s" % i, reftoc=b)
39
40 query = s.query( (B, C),
41 AND(B.cref == C.storeID,
42@@ -693,8 +692,8 @@
43 def entesten():
44 pops = B(store=s, name=u"Pops")
45 dad = B(store=s, name=u"Dad", cref=pops)
46- bro = B(store=s, name=u"Bro", cref=dad)
47- sis = B(store=s, name=u"Sis", cref=dad)
48+ B(store=s, name=u"Bro", cref=dad)
49+ B(store=s, name=u"Sis", cref=dad)
50
51 Gen1 = Placeholder(B)
52 Gen2 = Placeholder(B)
53@@ -1019,72 +1018,6 @@
54 store.getTableName(A)])
55
56
57-class FirstType(Item):
58- value = text()
59-
60-
61-class SecondType(Item):
62- value = text()
63- ref = reference(reftype=FirstType)
64-
65-
66-class QueryComplexity(TestCase):
67- comparison = AND(FirstType.value == u"foo",
68- SecondType.ref == FirstType.storeID,
69- SecondType.value == u"bar")
70-
71- def setUp(self):
72- self.store = Store()
73- self.query = self.store.query(FirstType, self.comparison)
74-
75- # Make one of each to get any initialization taken care of so it
76- # doesn't pollute our numbers below.
77- FirstType(store=self.store)
78- SecondType(store=self.store)
79-
80-
81- def test_firstTableOuterLoop(self):
82- """
83- Test that in a two table query, the table which appears first in the
84- result of the getInvolvedTables method of the comparison used is the
85- one which the outer join loop iterates over.
86-
87- Test this by inserting rows into the first table and checking that the
88- number of bytecodes executed increased.
89- """
90- counter = QueryCounter(self.store)
91- counts = []
92- for c in range(10):
93- counts.append(counter.measure(list, self.query))
94- FirstType(store=self.store)
95-
96- # Make sure they're not all the same
97- self.assertEqual(len(set(counts)), len(counts))
98-
99- # Make sure they're increasing
100- self.assertEqual(counts, sorted(counts))
101-
102-
103- def test_secondTableInnerLoop(self):
104- """
105- Like L{test_firstTableOuterLoop} but for the second table being
106- iterated over by the inner loop.
107-
108- This creates more rows in the second table while still performing a
109- query for which no rows in the first table satisfy the WHERE
110- condition. This should mean that rows from the second table are
111- never examined.
112- """
113- counter = QueryCounter(self.store)
114- count = None
115- for i in range(10):
116- c = counter.measure(list, self.query)
117- if count is None:
118- count = c
119- self.assertEqual(count, c)
120- SecondType(store=self.store)
121-
122-
123 class AndOrQueries(QueryingTestCase):
124 def testNoConditions(self):
125 self.assertRaises(ValueError, AND)
126@@ -1230,7 +1163,7 @@
127
128 def testOneOfWithList(self):
129 cx = C(store=self.store, name=u'x')
130- cy = C(store=self.store, name=u'y')
131+ C(store=self.store, name=u'y')
132 cz = C(store=self.store, name=u'z')
133
134 query = self.store.query(
135@@ -1243,7 +1176,7 @@
136 s = Store()
137
138 cx = C(store=s, name=u'x')
139- cy = C(store=s, name=u'y')
140+ C(store=s, name=u'y')
141 cz = C(store=s, name=u'z')
142
143 self.assertEquals(list(s.query(C, C.name.oneOf(set([u'x', u'z', u'a'])), sort=C.name.ascending)),
144@@ -1433,7 +1366,6 @@
145 """
146 Test that a column from a placeholder provides L{IColumn}.
147 """
148- value = 0
149 p = Placeholder(PlaceholderTestItem)
150 a = p.attr
151 self.failUnless(IColumn.providedBy(a))
152@@ -1458,7 +1390,6 @@
153 underlying Item class and comparing it to another column returns an
154 L{IComparison} provider.
155 """
156- value = 0
157 p = Placeholder(PlaceholderTestItem)
158 for op in COMPARISON_OPS:
159 self.failUnless(IComparison.providedBy(op(p.attr, PlaceholderTestItem.attr)))

Subscribers

People subscribed via source and target branches

to all changes: