From 386012597b9e7aa2a7f987930d00b892ed54121d Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 17 Feb 2020 11:51:33 -0500 Subject: 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 --- lib/sqlalchemy/testing/profiling.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/testing') 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: -- cgit v1.2.1