main commit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-16 16:30:25 +09:00
parent 91c7e04474
commit 537e7b363f
1146 changed files with 45926 additions and 77196 deletions

View File

@@ -1,5 +1,5 @@
# testing/engines.py
# Copyright (C) 2005-2025 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2023 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
@@ -289,7 +289,8 @@ def testing_engine(
options: Optional[Dict[str, Any]] = None,
asyncio: Literal[False] = False,
transfer_staticpool: bool = False,
) -> Engine: ...
) -> Engine:
...
@typing.overload
@@ -298,7 +299,8 @@ def testing_engine(
options: Optional[Dict[str, Any]] = None,
asyncio: Literal[True] = True,
transfer_staticpool: bool = False,
) -> AsyncEngine: ...
) -> AsyncEngine:
...
def testing_engine(
@@ -330,18 +332,16 @@ def testing_engine(
url = url or config.db.url
url = make_url(url)
if options is None:
if config.db is None or url.drivername == config.db.url.drivername:
options = config.db_opts
else:
options = {}
elif config.db is not None and url.drivername == config.db.url.drivername:
default_opt = config.db_opts.copy()
default_opt.update(options)
if (
config.db is None or url.drivername == config.db.url.drivername
) and config.db_opts:
use_options = config.db_opts.copy()
else:
use_options = {}
if options is not None:
use_options.update(options)
engine = create_engine(url, **use_options)
engine = create_engine(url, **options)
if sqlite_savepoint and engine.name == "sqlite":
# apply SQLite savepoint workaround
@@ -370,12 +370,7 @@ def testing_engine(
True # enable event blocks, helps with profiling
)
if (
isinstance(engine.pool, pool.QueuePool)
and "pool" not in use_options
and "pool_timeout" not in use_options
and "max_overflow" not in use_options
):
if isinstance(engine.pool, pool.QueuePool):
engine.pool._timeout = 0
engine.pool._max_overflow = 0
if use_reaper: