summaryrefslogtreecommitdiff
path: root/test/ext/asyncio/test_session_py3k.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2022-01-19 22:10:09 +0100
committerMike Bayer <mike_mp@zzzcomputing.com>2022-01-19 17:23:53 -0500
commite5606c0ba8bf2fed6daa7a488433d55ddbf302e9 (patch)
treec6cee53e939560f9081099e4465d855f25ca73de /test/ext/asyncio/test_session_py3k.py
parentb235a8cb1042cb7706dddc0f783cabb81e141055 (diff)
downloadsqlalchemy-e5606c0ba8bf2fed6daa7a488433d55ddbf302e9.tar.gz
Added missing method ``invalidate` in the `AsyncSession`
Fixes: #7524 Change-Id: I20387e6700015c44f23bd2d05347bdce802196c0
Diffstat (limited to 'test/ext/asyncio/test_session_py3k.py')
-rw-r--r--test/ext/asyncio/test_session_py3k.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ext/asyncio/test_session_py3k.py b/test/ext/asyncio/test_session_py3k.py
index 4e475b212..bcaea05e5 100644
--- a/test/ext/asyncio/test_session_py3k.py
+++ b/test/ext/asyncio/test_session_py3k.py
@@ -22,6 +22,7 @@ from sqlalchemy.testing import eq_
from sqlalchemy.testing import is_
from sqlalchemy.testing import is_true
from sqlalchemy.testing import mock
+from sqlalchemy.testing.assertions import is_false
from .test_engine_py3k import AsyncFixture as _AsyncFixture
from ...orm import _fixtures
@@ -488,6 +489,22 @@ class AsyncSessionTransactionTest(AsyncFixture):
result = await async_session.execute(select(User))
eq_(result.all(), [])
+ @async_test
+ @testing.requires.independent_connections
+ async def test_invalidate(self, async_session):
+ await async_session.execute(select(1))
+ conn = async_session.sync_session.connection()
+ fairy = conn.connection
+ connection_rec = fairy._connection_record
+
+ is_false(conn.closed)
+ is_false(connection_rec._is_hard_or_soft_invalidated())
+ await async_session.invalidate()
+ is_true(conn.closed)
+ is_true(connection_rec._is_hard_or_soft_invalidated())
+
+ eq_(async_session.in_transaction(), False)
+
class AsyncCascadesTest(AsyncFixture):
run_inserts = None