Skip to content

Commit 1f46187

Browse files
Pin URL-governor plumbing end-to-end through the async DBAPI connect
The existing URL-query tests only assert that create_connect_args builds the right kwargs dict — they don't invoke the aio DBAPI's connect() factory, so a regression where aio.connect() silently drops a kwarg (raising TypeError at engine-connect time) slipped past CI. Add an end-to-end pin: resolve the URL through the dialect, feed the resulting kwargs into DqliteDialect_aio.import_dbapi().connect(), and assert the constructed AsyncConnection carries the expected governor values. Pins the dialect→URL→DBAPI plumbing chain against silent drift. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 52d00ab commit 1f46187

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

tests/test_dialect_dialect_config.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,33 @@ def test_trust_server_heartbeat_parses_boolean(self, raw: str, expected: bool) -
127127
assert kwargs["trust_server_heartbeat"] is expected
128128

129129

130+
class TestURLGovernorsReachAioDbapi:
131+
"""End-to-end test: every URL governor knob must be accepted by the
132+
async DBAPI's connect(). The unit-level create_connect_args tests only
133+
prove the dialect builds the right kwargs dict — they don't catch the
134+
regression where aio.connect() silently drops kwargs and raises
135+
TypeError when invoked by DqliteDialect_aio.connect().
136+
"""
137+
138+
def test_all_governors_forwarded_end_to_end(self) -> None:
139+
from sqlalchemydqlite.aio import DqliteDialect_aio
140+
141+
dialect = DqliteDialect_aio()
142+
url = make_url(
143+
"dqlite+aio://host:19001/db"
144+
"?timeout=5&max_total_rows=500"
145+
"&max_continuation_frames=7&trust_server_heartbeat=true"
146+
)
147+
_, kwargs = dialect.create_connect_args(url)
148+
aio_module = DqliteDialect_aio.import_dbapi()
149+
# Must not raise TypeError: unexpected keyword argument.
150+
conn = aio_module.connect(**kwargs)
151+
assert conn._max_total_rows == 500
152+
assert conn._max_continuation_frames == 7
153+
assert conn._trust_server_heartbeat is True
154+
assert conn._timeout == 5
155+
156+
130157
class TestDoPingNarrowExceptions:
131158
def test_returns_true_on_success(self) -> None:
132159
dialect = DqliteDialect()

0 commit comments

Comments
 (0)