Skip to content

Commit b211bf3

Browse files
authored
Update testing_engine() annotations (#7818)
1 parent 550454c commit b211bf3

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

stubs/SQLAlchemy/@tests/stubtest_allowlist.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ sqlalchemy.engine.base.Connection.engine
122122
sqlalchemy.engine.URL.normalized_query
123123
sqlalchemy.engine.url.URL.normalized_query
124124

125+
# runtime has extra internal arguments that are inconsistent across micro versions
126+
sqlalchemy.testing.engines.testing_engine
127+
125128
# unclear problems
126129
sqlalchemy.sql.elements.quoted_name.lower
127130
sqlalchemy.sql.elements.quoted_name.upper

stubs/SQLAlchemy/sqlalchemy/testing/engines.pyi

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
from typing import Any
1+
from collections.abc import Mapping
2+
from typing import Any, overload
3+
from typing_extensions import Literal
4+
5+
from ..engine import Engine
6+
from ..engine.url import URL
7+
from ..ext.asyncio import AsyncEngine
28

39
class ConnectionKiller:
410
proxy_refs: Any
@@ -37,14 +43,22 @@ class ReconnectFixture:
3743
def restart(self) -> None: ...
3844

3945
def reconnecting_engine(url: Any | None = ..., options: Any | None = ...): ...
46+
@overload
47+
def testing_engine( # type: ignore[misc]
48+
url: URL | str | None = ...,
49+
options: Mapping[str, Any] | None = ...,
50+
future: bool | None = ...,
51+
asyncio: Literal[False] = ...,
52+
transfer_staticpool: bool = ...,
53+
) -> Engine: ...
54+
@overload
4055
def testing_engine(
41-
url: Any | None = ...,
42-
options: Any | None = ...,
43-
future: Any | None = ...,
44-
asyncio: bool = ...,
56+
url: URL | str | None = ...,
57+
options: Mapping[str, Any] | None = ...,
58+
future: bool | None = ...,
59+
asyncio: Literal[True] = ...,
4560
transfer_staticpool: bool = ...,
46-
_sqlite_savepoint: bool = ...,
47-
): ...
61+
) -> AsyncEngine: ...
4862
def mock_engine(dialect_name: Any | None = ...): ...
4963

5064
class DBAPIProxyCursor:

0 commit comments

Comments
 (0)