diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-02-17 11:51:33 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-02-17 14:41:21 -0500 |
| commit | 386012597b9e7aa2a7f987930d00b892ed54121d (patch) | |
| tree | 91bdc92e2848cd826211d7ac97a7a053606244dc /lib/sqlalchemy/testing/profiling.py | |
| parent | 3c7765b49c0aba253c11f435b2923bb488d15809 (diff) | |
| download | sqlalchemy-386012597b9e7aa2a7f987930d00b892ed54121d.tar.gz | |
Limit non-backend critical profiling tests to SQLite
issues with backend-specific profiling should be limited
to tests that are explcitly against resultset, compiler, etc.
MySQL in particular has an often varying callcount that isn't
worth running these tests against nor is it worth profiling
them for other backends like Oracle and SQL Server.
Also add the REQUIRE_SQLALCHEMY_CEXT flag to
the regen_callcounts.tox.ini script, which is part of some review
somewhere but is needed here to generate callcounts correctly.
Add a "warmup" phase for some of the ORM tests for join conditions
that have varying profile counts based on whether mappings have been
used already or not; profiling should always be against the
"warmed up" version of a function.
Change-Id: If483820235fa4cc4360cbd067a9b68d83512d587
Diffstat (limited to 'lib/sqlalchemy/testing/profiling.py')
| -rw-r--r-- | lib/sqlalchemy/testing/profiling.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/testing/profiling.py b/lib/sqlalchemy/testing/profiling.py index cc6557018..0026b5f8c 100644 --- a/lib/sqlalchemy/testing/profiling.py +++ b/lib/sqlalchemy/testing/profiling.py @@ -220,7 +220,7 @@ class ProfileStatsFile(object): profile_f.close() -def function_call_count(variance=0.05, times=1): +def function_call_count(variance=0.05, times=1, warmup=0): """Assert a target for a test case's function call count. The main purpose of this assertion is to detect changes in @@ -239,6 +239,9 @@ def function_call_count(variance=0.05, times=1): @decorator def wrap(fn, *args, **kw): + for warm in range(warmup): + fn(*args, **kw) + timerange = range(times) with count_functions(variance=variance): for time in timerange: |
