summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/profiling.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-12-07 17:48:32 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2014-12-07 17:48:32 -0500
commit1b260c7959c9b89e6a3993d5d96bc6b0918a8fb0 (patch)
tree59602c3151094de79d84c60391cf64e4a1b94084 /lib/sqlalchemy/testing/profiling.py
parent68f1bcc9da191fc72a943f2353c8d80a39bdb76a (diff)
parentc8817e608788799837a91b1d2616227594698d2b (diff)
downloadsqlalchemy-1b260c7959c9b89e6a3993d5d96bc6b0918a8fb0.tar.gz
Merge branch 'master' into ticket_3100
Diffstat (limited to 'lib/sqlalchemy/testing/profiling.py')
-rw-r--r--lib/sqlalchemy/testing/profiling.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/sqlalchemy/testing/profiling.py b/lib/sqlalchemy/testing/profiling.py
index fcb888f86..671bbe32d 100644
--- a/lib/sqlalchemy/testing/profiling.py
+++ b/lib/sqlalchemy/testing/profiling.py
@@ -42,7 +42,11 @@ class ProfileStatsFile(object):
"""
def __init__(self, filename):
- self.write = (
+ self.force_write = (
+ config.options is not None and
+ config.options.force_write_profiles
+ )
+ self.write = self.force_write or (
config.options is not None and
config.options.write_profiles
)
@@ -115,7 +119,11 @@ class ProfileStatsFile(object):
per_fn = self.data[test_key]
per_platform = per_fn[self.platform_key]
counts = per_platform['counts']
- counts[-1] = callcount
+ current_count = per_platform['current_count']
+ if current_count < len(counts):
+ counts[current_count - 1] = callcount
+ else:
+ counts[-1] = callcount
if self.write:
self._write()
@@ -235,7 +243,7 @@ def count_functions(variance=0.05):
deviance = int(callcount * variance)
failed = abs(callcount - expected_count) > deviance
- if failed:
+ if failed or _profile_stats.force_write:
if _profile_stats.write:
_profile_stats.replace(callcount)
else: