From: Mike Bayer Date: Sat, 1 Nov 2025 13:56:18 +0000 (-0400) Subject: use the default driver for sparse backend X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=725d1a19b4e638c4a5ef40534397423c6c016614;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git use the default driver for sparse backend the memusage tests use sparse_backend but should use the main driver in a set; they were using the pysqlite_numeric dialect which is not a real dialect and apparently runs dramatically slower for the memusage tests since it generates more memory artifacts. Change-Id: Icf19ac1a3cae862a48ddcec565079c960b8ac2b7 --- diff --git a/lib/sqlalchemy/testing/config.py b/lib/sqlalchemy/testing/config.py index f3598f0910..6bac66b4f4 100644 --- a/lib/sqlalchemy/testing/config.py +++ b/lib/sqlalchemy/testing/config.py @@ -328,11 +328,24 @@ class Config: self.test_schema = "test_schema" self.test_schema_2 = "test_schema_2" + self.is_default_dialect = ( + db.url._get_entrypoint() + is db.url.set( + drivername=db.url.get_backend_name() + )._get_entrypoint() + ) self.is_async = db.dialect.is_async _stack = collections.deque() _configs = set() + def __repr__(self): + return ( + f"sqlalchemy.testing.config.Config" + f"({self.db.name}+{self.db.driver}, " + f"{self.db.dialect.server_version_info})" + ) + def _set_name(self, db): suffix = "_async" if db.dialect.is_async else "" if db.dialect.server_version_info: diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index 96057e0942..1b7a042d17 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -683,16 +683,19 @@ def _possible_configs_for_cls(cls, reasons=None, sparse=False): # sorted so we get the same backend each time selecting the highest # server version info. per_dialect = {} - for cfg in reversed( + + sorted_all_configs = reversed( sorted( all_configs, key=lambda cfg: ( + "z" if cfg.is_default_dialect else "a", cfg.db.name, cfg.db.driver, cfg.db.dialect.server_version_info, ), ) - ): + ) + for cfg in sorted_all_configs: db = cfg.db.name if db not in per_dialect: per_dialect[db] = cfg