]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
final cleanup
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 10 Aug 2012 15:10:21 +0000 (11:10 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 10 Aug 2012 15:10:21 +0000 (11:10 -0400)
test/aaa_profiling/test_orm.py
test/aaa_profiling/test_resultset.py
test/aaa_profiling/test_zoomark.py
test/lib/profiling.py

index 920d6ee9d908856cc6f81e44dce57751d1e12bac..83351d6b88b3dd2764046df3d33f7e661a62b243 100644 (file)
@@ -60,14 +60,14 @@ class MergeTest(fixtures.MappedTest):
         # down from 185 on this this is a small slice of a usually
         # bigger operation so using a small variance
 
-        @profiling.function_call_count(96, {}, variance=0.10)
+        @profiling.function_call_count(96, variance=0.10)
         def go1():
             return sess2.merge(p1, load=False)
         p2 = go1()
 
         # third call, merge object already present. almost no calls.
 
-        @profiling.function_call_count(16, {}, variance=0.10)
+        @profiling.function_call_count(16, variance=0.10)
         def go2():
             return sess2.merge(p2, load=False)
         go2()
@@ -85,7 +85,7 @@ class MergeTest(fixtures.MappedTest):
         # using sqlite3 the C extension took it back up to approx. 1257
         # (py2.6)
 
-        @profiling.function_call_count(1128, {}, variance=0.10)
+        @profiling.function_call_count(1128, variance=0.10)
         def go():
             p2 = sess2.merge(p1)
         go()
index 84eb34df1550bd47d2d3ef76b57a2bffde249e77..29db46ef4f0b6257720a4cdc6caa57f8dc14e28b 100644 (file)
@@ -34,11 +34,11 @@ class ResultSetTest(fixtures.TestBase, AssertsExecutionResults):
     def teardown(self):
         metadata.drop_all()
 
-    @profiling.function_call_count(354)
+    @profiling.function_call_count(336)
     def test_string(self):
         [tuple(row) for row in t.select().execute().fetchall()]
 
-    @profiling.function_call_count(354)
+    @profiling.function_call_count(336)
     def test_unicode(self):
         [tuple(row) for row in t2.select().execute().fetchall()]
 
index 50b3da076fa206467eba5ed15eea5cd8bd69d713..a254ff15f46447f634843fef71bec24433532c43 100644 (file)
@@ -393,7 +393,7 @@ class ZooMarkTest(fixtures.TestBase):
     def test_profile_6_editing(self):
         self.test_baseline_6_editing()
 
-    @profiling.function_call_count(2095)
+    @profiling.function_call_count(1970)
     def test_profile_7_multiview(self):
         self.test_baseline_7_multiview()
 
index ca93543489157d97bfd6141419c9885856f88cc2..7f73c5829caa5df89fca3d16c984702df34a2f2d 100644 (file)
@@ -79,8 +79,20 @@ def profiled(target=None, **target_opts):
         return result
     return decorate
 
-def function_call_count(count=None, versions={}, variance=0.05):
-    """Assert a target for a test case's function call count."""
+def function_call_count(count=None, variance=0.05):
+    """Assert a target for a test case's function call count.
+
+    The main purpose of this assertion is to detect changes in
+    callcounts for various functions - the actual number is not as important.
+    Therefore, to help with cross-compatibility between Python interpreter
+    platforms/versions
+    as well as whether or not C extensions are in use, the call count is
+    "adjusted" to account for various functions that don't appear in all
+    environments.   This introduces the small possibility for a significant change
+    in callcount to be missed, in the case that the callcount is local
+    to that set of skipped functions.
+
+    """
 
     py_version = '.'.join([str(v) for v in sys.version_info])
 
@@ -159,7 +171,7 @@ def _exclude(path):
     if (
             "result.py" in pfname or
             "engine/base.py" in pfname
-        ) and pfuncname in ("__iter__", "__getitem__"):
+        ) and pfuncname in ("__iter__", "__getitem__", "__len__", "__init__"):
         return True
 
     if "utf_8.py" in pfname and pfuncname == "decode":