Skip to content

Commit fcde0a4

Browse files
committed
add test case
1 parent 0a5b1f2 commit fcde0a4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/pep492/test_async_with.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import aiomysql
44
import pytest
55

6-
from aiomysql import sa, create_pool
6+
from aiomysql import sa, create_pool, DictCursor
77
from sqlalchemy import MetaData, Table, Column, Integer, String
88

99

@@ -266,3 +266,13 @@ async def test_transaction_context_manager_commit_once(loop, mysql_params,
266266
await tr2.commit()
267267
assert not tr2.is_active
268268
assert conn.closed
269+
270+
271+
@pytest.mark.run_loop
272+
async def test_incompatible_cursor_fails(loop, mysql_params):
273+
mysql_params['cursorclass'] = DictCursor
274+
with pytest.raises(sa.ArgumentError) as ctx:
275+
await sa.create_engine(loop=loop, **mysql_params)
276+
277+
msg = 'SQLAlchemy engine does not support this cursor class'
278+
assert str(ctx.value) == msg

0 commit comments

Comments
 (0)