]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- allow cextension version to fall back to non-cextension
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 23 Dec 2010 01:36:20 +0000 (20:36 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 23 Dec 2010 01:36:20 +0000 (20:36 -0500)
- start taking out "default" version, 2.4 version, only need these tests
in a relative sense

test/aaa_profiling/test_compiler.py
test/aaa_profiling/test_resultset.py
test/lib/profiling.py

index 5d32ee58120c5349693a8ff65ceb564e894e8f62..37fc4fb2041a724c3d4f003a7489d9f76832245f 100644 (file)
@@ -32,20 +32,20 @@ class CompileTest(TestBase, AssertsExecutionResults):
         
         cls.dialect = default.DefaultDialect()
         
-    @profiling.function_call_count(58, {'2.4': 44, 
+    @profiling.function_call_count(versions={'2.7':58, '2.6':58,
                                             '3.0':77, '3.1':77})
     def test_insert(self):
         t1.insert().compile(dialect=self.dialect)
 
-    @profiling.function_call_count(49, {'2.4': 45})
+    @profiling.function_call_count(versions={'2.6':49, '2.7':49})
     def test_update(self):
         t1.update().compile(dialect=self.dialect)
 
-    @profiling.function_call_count(110, {'2.4': 81, '3':132})
+    @profiling.function_call_count(versions={'2.6':110, '2.7':110, '2.4': 81, '3':132})
     def test_update_whereclause(self):
         t1.update().where(t1.c.c2==12).compile(dialect=self.dialect)
 
-    @profiling.function_call_count(148, versions={'2.4':105, 
+    @profiling.function_call_count(versions={'2.4':105, '2.7':148, '2.6':148,
                                                 '3.0':208, '3.1':208})
     def test_select(self):
         s = select([t1], t1.c.c2==t2.c.c1)
index dc4732cb83230c50f8e11155d39655551a461131..51199eb3adfce29a6e585622bd7185fb99978129 100644 (file)
@@ -33,7 +33,10 @@ class ResultSetTest(TestBase, AssertsExecutionResults):
     def teardown(self):
         metadata.drop_all()
 
-    @profiling.function_call_count(14416, versions={'2.4': 13214,
+    @profiling.function_call_count(versions={
+                                    '2.4': 13214,
+                                    '2.6':14416,
+                                    '2.7':14416,
                                    '2.6+cextension': 345,
                                    '2.7+cextension':345})
     def test_string(self):
@@ -41,7 +44,9 @@ class ResultSetTest(TestBase, AssertsExecutionResults):
 
     # sqlite3 returns native unicode.  so shouldn't be an increase here.
 
-    @profiling.function_call_count(14396, versions={'2.4': 13214,
+    @profiling.function_call_count(versions={
+                                    '2.7':14396,
+                                    '2.6':14396,
                                    '2.6+cextension': 345, 
                                    '2.7+cextension':345})
     def test_unicode(self):
@@ -57,7 +62,7 @@ class ExecutionTest(TestBase):
         # ensure initial connect activities complete
         c.execute("select 1")
         
-        @profiling.function_call_count(36, versions={'2.6':35, '2.5':35, 
+        @profiling.function_call_count(versions={'2.7':36, '2.6':35, '2.5':35, 
                                                     '2.4':21, '3':34}, 
                                             variance=.10)
         def go():
@@ -70,8 +75,9 @@ class ExecutionTest(TestBase):
         # ensure initial connect activities complete
         e.execute("select 1")
 
-        @profiling.function_call_count(56, versions={'2.4':41, '2.5':58, 
+        @profiling.function_call_count(versions={'2.4':41, '2.5':58, 
                                                     '2.6':58, '3':57,
+                                                    '2.7':56,
                                                     '2.6+cextension':56}, 
                                             variance=.05)
         def go():
index 2b358d500116877a6a2963dd5f87d9de69fc693c..441fe931dc382e7590098e8665f188b55006499e 100644 (file)
@@ -113,14 +113,17 @@ def function_call_count(count=None, versions={}, variance=0.05):
         cextension = True
     except ImportError:
         cextension = False
-        
+    
     while version_info:
         version = '.'.join([str(v) for v in version_info])
-        if cextension:
+        if cextension and (version + "+cextension") in versions:
             version += "+cextension"
-        if version in versions:
             count = versions[version]
             break
+        elif version in versions:
+            count = versions[version]
+            break
+
         version_info.pop()
 
     if count is None: