diff options
author | Federico Caselli <cfederico87@gmail.com> | 2021-09-28 22:58:08 +0200 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2021-09-28 23:11:46 +0200 |
commit | 8fa9392360c144ba8391add65cfb8dc4a1067d51 (patch) | |
tree | 5ba856cb9d524e9645407dae96ff5612a5d92f45 /test/ext/asyncio/test_scoping_py3k.py | |
parent | 0f9335b8aa0047ee410848e30a7899db24f9b745 (diff) | |
download | sqlalchemy-8fa9392360c144ba8391add65cfb8dc4a1067d51.tar.gz |
Add missing methods added in :ticket:`6991`
to ``scoped_session`` and ``async_scoped_session``.
Fixes: #7103
Change-Id: If80481771d9b428f2403af3862e0479bd069257e
Diffstat (limited to 'test/ext/asyncio/test_scoping_py3k.py')
-rw-r--r-- | test/ext/asyncio/test_scoping_py3k.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/ext/asyncio/test_scoping_py3k.py b/test/ext/asyncio/test_scoping_py3k.py index c2ca73c41..7eeff566c 100644 --- a/test/ext/asyncio/test_scoping_py3k.py +++ b/test/ext/asyncio/test_scoping_py3k.py @@ -1,9 +1,12 @@ +from asyncio import current_task + import sqlalchemy as sa from sqlalchemy import func from sqlalchemy import select from sqlalchemy import testing from sqlalchemy.ext.asyncio import async_scoped_session from sqlalchemy.ext.asyncio import AsyncSession as _AsyncSession +from sqlalchemy.orm import sessionmaker from sqlalchemy.testing import async_test from sqlalchemy.testing import eq_ from sqlalchemy.testing import is_ @@ -44,3 +47,32 @@ class AsyncScopedSessionTest(AsyncFixture): await AsyncSession.delete(u1) await AsyncSession.flush() eq_(await conn.scalar(stmt), 0) + + def test_attributes(self, async_engine): + expected = [ + name + for cls in _AsyncSession.mro() + for name in vars(cls) + if not name.startswith("_") + ] + + ignore_list = { + "dispatch", + "sync_session_class", + "run_sync", + "get_transaction", + "get_nested_transaction", + "in_transaction", + "in_nested_transaction", + } + + SM = async_scoped_session( + sessionmaker(async_engine, class_=_AsyncSession), current_task + ) + + missing = [ + name + for name in expected + if not hasattr(SM, name) and name not in ignore_list + ] + eq_(missing, []) |