diff options
author | Federico Caselli <cfederico87@gmail.com> | 2021-02-06 12:11:54 +0100 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2021-02-06 12:11:54 +0100 |
commit | 23e088bccff02f18e4a27ef9dfc656c814695525 (patch) | |
tree | 3237cc438cc69e818474964df8feb21aa0cc566f /test/ext/asyncio/test_engine_py3k.py | |
parent | bc9221bf781adfffdddf12860d4eed7650457a0a (diff) | |
download | sqlalchemy-23e088bccff02f18e4a27ef9dfc656c814695525.tar.gz |
Detect non async driver on engine creation
An error is raised when creating an async engine with an
incompatible dbapi. Before the error was raised only when
first using the engine.
Change-Id: I977952b4c03ae51f568749ad744c545197bcd887
Reference: #5920
Diffstat (limited to 'test/ext/asyncio/test_engine_py3k.py')
-rw-r--r-- | test/ext/asyncio/test_engine_py3k.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/ext/asyncio/test_engine_py3k.py b/test/ext/asyncio/test_engine_py3k.py index 72d866882..512f0447f 100644 --- a/test/ext/asyncio/test_engine_py3k.py +++ b/test/ext/asyncio/test_engine_py3k.py @@ -1,6 +1,7 @@ import asyncio from sqlalchemy import Column +from sqlalchemy import create_engine from sqlalchemy import delete from sqlalchemy import event from sqlalchemy import exc @@ -662,9 +663,18 @@ class AsyncResultTest(EngineFixture): class TextSyncDBAPI(fixtures.TestBase): + def test_sync_dbapi_raises(self): + with expect_raises_message( + exc.InvalidRequestError, + "The asyncio extension requires an async driver to be used.", + ): + create_async_engine("sqlite:///:memory:") + @testing.fixture def async_engine(self): - return create_async_engine("sqlite:///:memory:") + engine = create_engine("sqlite:///:memory:", future=True) + engine.dialect.is_async = True + return _async_engine.AsyncEngine(engine) @async_test @combinations( |