diff options
author | Jonathan Beluch <jbeluch@squarespace.com> | 2016-08-23 15:10:53 -0400 |
---|---|---|
committer | Jonathan Beluch <jbeluch@squarespace.com> | 2016-08-24 14:16:10 -0400 |
commit | edf8380b90f60f8e7a4f7b0d5edef5c4aa563279 (patch) | |
tree | 67809ad2997f0fc874d1e7b62cef9d6a81dece9a /test/engine/test_bind.py | |
parent | f10eba00ea7c92315b4b39c69627058ad4931448 (diff) | |
download | sqlalchemy-pr/301.tar.gz |
Fix conn close behavior for thread local connectionspr/301
Diffstat (limited to 'test/engine/test_bind.py')
-rw-r--r-- | test/engine/test_bind.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/engine/test_bind.py b/test/engine/test_bind.py index 69ab721c1..14c2e0162 100644 --- a/test/engine/test_bind.py +++ b/test/engine/test_bind.py @@ -2,7 +2,7 @@ including the deprecated versions of these arguments""" from sqlalchemy.testing import assert_raises, assert_raises_message -from sqlalchemy import engine, exc +from sqlalchemy import engine, exc, create_engine from sqlalchemy import MetaData, ThreadLocalMetaData from sqlalchemy import Integer, text from sqlalchemy.testing.schema import Table @@ -23,6 +23,21 @@ class BindTest(fixtures.TestBase): assert not conn.closed assert conn.closed + def test_tlbind_close_conn(self): + e = create_engine(testing.db.url, strategy='threadlocal') + conn = e.contextual_connect() + e.execute('select 1').fetchall() + conn.close() + assert conn.closed + + def test_tlbind_close_trans_conn(self): + e = create_engine(testing.db.url, strategy='threadlocal') + conn = e.contextual_connect() + with e.begin(): + pass + conn.close() + assert conn.closed + def test_bind_close_conn(self): e = testing.db conn = e.connect() |