# 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()
# 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()
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()]
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()
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])
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":