diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-03-05 17:34:10 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-03-06 23:15:17 -0500 |
| commit | 3a378f0b22e1745509d88b923123dc38d8014274 (patch) | |
| tree | 669ad5260463d43307a4d33fc8eead88248fb0f3 /test/engine/test_pool.py | |
| parent | 1f3ef9817453faa021544841d10b5b7107b57916 (diff) | |
| download | sqlalchemy-3a378f0b22e1745509d88b923123dc38d8014274.tar.gz | |
Replace reset_agent with direct call from connection
Fixed a regression where the "reset agent" of the connection pool wasn't
really being utilized by the :class:`_engine.Connection` when it were
closed, and also leading to a double-rollback scenario that was somewhat
wasteful. The newer architecture of the engine has been updated so that
the connection pool "reset-on-return" logic will be skipped when the
:class:`_engine.Connection` explicitly closes out the transaction before
returning the pool to the connection.
Fixes: #6004
Change-Id: I5d2ac16cac71aa45a00b4b7481d7268bd828a168
Diffstat (limited to 'test/engine/test_pool.py')
| -rw-r--r-- | test/engine/test_pool.py | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/test/engine/test_pool.py b/test/engine/test_pool.py index f29373e95..3c2257331 100644 --- a/test/engine/test_pool.py +++ b/test/engine/test_pool.py @@ -1817,92 +1817,6 @@ class ResetOnReturnTest(PoolTestBase): assert not dbapi.connect().rollback.called assert not dbapi.connect().commit.called - def test_agent_rollback(self): - dbapi, p = self._fixture(reset_on_return="rollback") - - class Agent(object): - def __init__(self, conn): - self.conn = conn - - is_active = True - - def rollback(self): - self.conn.special_rollback() - - def commit(self): - self.conn.special_commit() - - c1 = p.connect() - c1._reset_agent = Agent(c1) - c1.close() - - assert dbapi.connect().special_rollback.called - assert not dbapi.connect().special_commit.called - - assert not dbapi.connect().rollback.called - assert not dbapi.connect().commit.called - - c1 = p.connect() - c1.close() - eq_(dbapi.connect().special_rollback.call_count, 1) - eq_(dbapi.connect().special_commit.call_count, 0) - - assert dbapi.connect().rollback.called - assert not dbapi.connect().commit.called - - def test_agent_commit(self): - dbapi, p = self._fixture(reset_on_return="commit") - - class Agent(object): - def __init__(self, conn): - self.conn = conn - - is_active = True - - def rollback(self): - self.conn.special_rollback() - - def commit(self): - self.conn.special_commit() - - c1 = p.connect() - c1._reset_agent = Agent(c1) - c1.close() - assert not dbapi.connect().special_rollback.called - assert dbapi.connect().special_commit.called - - assert not dbapi.connect().rollback.called - assert not dbapi.connect().commit.called - - c1 = p.connect() - c1.close() - - eq_(dbapi.connect().special_rollback.call_count, 0) - eq_(dbapi.connect().special_commit.call_count, 1) - assert not dbapi.connect().rollback.called - assert dbapi.connect().commit.called - - def test_reset_agent_disconnect(self): - dbapi, p = self._fixture(reset_on_return="rollback") - - class Agent(object): - def __init__(self, conn): - self.conn = conn - - def rollback(self): - p._invalidate(self.conn) - raise Exception("hi") - - def commit(self): - self.conn.commit() - - c1 = p.connect() - c1._reset_agent = Agent(c1) - c1.close() - - # no warning raised. We know it would warn due to - # QueuePoolTest.test_no_double_checkin - class SingletonThreadPoolTest(PoolTestBase): @testing.requires.threading_with_mock |
