diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2023-04-13 21:05:19 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2023-04-13 21:05:19 +0000 |
| commit | 4f104c9cb54e1429947d5bbf9375c86dcd07c0c9 (patch) | |
| tree | be73f959ef908e5374069893bb0e7d9d81517e6c /test/ext | |
| parent | b066c45dc491716a4e34bdeb9a9726bcbc136fb5 (diff) | |
| parent | 541ada1bad609b7f2052d0b02214387e242c6cc5 (diff) | |
| download | sqlalchemy-4f104c9cb54e1429947d5bbf9375c86dcd07c0c9.tar.gz | |
Merge "Add pool creation functions" into main
Diffstat (limited to 'test/ext')
| -rw-r--r-- | test/ext/asyncio/test_engine_py3k.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ext/asyncio/test_engine_py3k.py b/test/ext/asyncio/test_engine_py3k.py index 9511fed74..786f841ee 100644 --- a/test/ext/asyncio/test_engine_py3k.py +++ b/test/ext/asyncio/test_engine_py3k.py @@ -1,5 +1,6 @@ import asyncio import inspect as stdlib_inspect +from unittest.mock import patch from sqlalchemy import Column from sqlalchemy import create_engine @@ -18,6 +19,7 @@ from sqlalchemy import union_all from sqlalchemy.engine import cursor as _cursor from sqlalchemy.ext.asyncio import async_engine_from_config from sqlalchemy.ext.asyncio import create_async_engine +from sqlalchemy.ext.asyncio import create_async_pool_from_url from sqlalchemy.ext.asyncio import engine as _async_engine from sqlalchemy.ext.asyncio import exc as async_exc from sqlalchemy.ext.asyncio import exc as asyncio_exc @@ -707,6 +709,25 @@ class AsyncEngineTest(EngineFixture): assert engine.dialect.is_async is True +class AsyncCreatePoolTest(fixtures.TestBase): + @config.fixture + def mock_create(self): + with patch( + "sqlalchemy.ext.asyncio.engine._create_pool_from_url", + ) as p: + yield p + + def test_url_only(self, mock_create): + create_async_pool_from_url("sqlite://") + mock_create.assert_called_once_with("sqlite://", _is_async=True) + + def test_pool_args(self, mock_create): + create_async_pool_from_url("sqlite://", foo=99, echo=True) + mock_create.assert_called_once_with( + "sqlite://", foo=99, echo=True, _is_async=True + ) + + class AsyncEventTest(EngineFixture): """The engine events all run in their normal synchronous context. |
