From: Mike Bayer Date: Fri, 10 Aug 2012 15:10:21 +0000 (-0400) Subject: final cleanup X-Git-Tag: rel_0_8_0b1~269 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2f522bd2217ca3421a912413f66b42dcec164df3;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git final cleanup --- diff --git a/test/aaa_profiling/test_orm.py b/test/aaa_profiling/test_orm.py index 920d6ee9d9..83351d6b88 100644 --- a/test/aaa_profiling/test_orm.py +++ b/test/aaa_profiling/test_orm.py @@ -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() diff --git a/test/aaa_profiling/test_resultset.py b/test/aaa_profiling/test_resultset.py index 84eb34df15..29db46ef4f 100644 --- a/test/aaa_profiling/test_resultset.py +++ b/test/aaa_profiling/test_resultset.py @@ -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()] diff --git a/test/aaa_profiling/test_zoomark.py b/test/aaa_profiling/test_zoomark.py index 50b3da076f..a254ff15f4 100644 --- a/test/aaa_profiling/test_zoomark.py +++ b/test/aaa_profiling/test_zoomark.py @@ -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() diff --git a/test/lib/profiling.py b/test/lib/profiling.py index ca93543489..7f73c5829c 100644 --- a/test/lib/profiling.py +++ b/test/lib/profiling.py @@ -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":