summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/testing/plugin/plugin_base.py10
-rw-r--r--lib/sqlalchemy/testing/profiling.py5
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py
index 4593f1431..859d1d779 100644
--- a/lib/sqlalchemy/testing/plugin/plugin_base.py
+++ b/lib/sqlalchemy/testing/plugin/plugin_base.py
@@ -102,6 +102,13 @@ def setup_options(make_option):
help="Don't run memory profiling tests",
)
make_option(
+ "--profile-sort",
+ type="string",
+ default="cumulative",
+ dest="profilesort",
+ help="Type of sort for profiling standard output",
+ )
+ make_option(
"--postgresql-templatedb",
type="string",
help="name of template database to use for PostgreSQL "
@@ -474,7 +481,8 @@ def _setup_profiling(options, file_config):
from sqlalchemy.testing import profiling
profiling._profile_stats = profiling.ProfileStatsFile(
- file_config.get("sqla_testing", "profile_file")
+ file_config.get("sqla_testing", "profile_file"),
+ sort=options.profilesort,
)
diff --git a/lib/sqlalchemy/testing/profiling.py b/lib/sqlalchemy/testing/profiling.py
index a75549027..bfc4997e1 100644
--- a/lib/sqlalchemy/testing/profiling.py
+++ b/lib/sqlalchemy/testing/profiling.py
@@ -65,7 +65,7 @@ class ProfileStatsFile(object):
"""
- def __init__(self, filename):
+ def __init__(self, filename, sort="cumulative"):
self.force_write = (
config.options is not None and config.options.force_write_profiles
)
@@ -77,6 +77,7 @@ class ProfileStatsFile(object):
self.data = collections.defaultdict(
lambda: collections.defaultdict(dict)
)
+ self.sort = sort
self._read()
if self.write:
# rewrite for the case where features changed,
@@ -277,7 +278,7 @@ def count_functions(variance=0.05):
line_no, expected_count = expected
print(("Pstats calls: %d Expected %s" % (callcount, expected_count)))
- stats.sort_stats("cumulative")
+ stats.sort_stats(_profile_stats.sort)
stats.print_stats()
if _profile_stats.force_write: