summaryrefslogtreecommitdiff
path: root/test/engine/test_pool.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-02-01 12:27:09 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2020-02-01 13:12:57 -0500
commitc797056413230cc5c11bc458e5f7760063c2682e (patch)
tree58a7cebda24e574aafe4a04b1258680248ed59fd /test/engine/test_pool.py
parent2df647cd7590ae31b542256a5036d2ff49f321aa (diff)
downloadsqlalchemy-c797056413230cc5c11bc458e5f7760063c2682e.tar.gz
Do away with pool._refs
This collection was added only for the benefit of unit tests and is unnecessary for the pool to function. As SQLAlchemy 2.0 will be removing the automatic handling of connections that are garbage collection, remove this collection so that we ultimately don't need a weakref handler to do anything within the pool. The handler will do nothing other than emit a warning that a connection was dereferenced without being explicitly returned to the pool, invalidated, or detached. Change-Id: I4ca196270d5714efbac44dbf6f034e8c7f0af58a
Diffstat (limited to 'test/engine/test_pool.py')
-rw-r--r--test/engine/test_pool.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/engine/test_pool.py b/test/engine/test_pool.py
index e4d6dba57..cfe20f5ec 100644
--- a/test/engine/test_pool.py
+++ b/test/engine/test_pool.py
@@ -725,6 +725,8 @@ class QueuePoolTest(PoolTestBase):
def _do_testqueuepool(self, useclose=False):
p = self._queuepool_fixture(pool_size=3, max_overflow=-1)
+ reaper = testing.engines.ConnectionKiller()
+ reaper.add_pool(p)
def status(pool):
return (
@@ -772,8 +774,8 @@ class QueuePoolTest(PoolTestBase):
lazy_gc()
self.assert_(status(p) == (3, 2, 0, 1))
c1.close()
- lazy_gc()
- assert not pool._refs
+
+ reaper.assert_all_closed()
def test_timeout_accessor(self):
expected_timeout = 123
@@ -837,7 +839,7 @@ class QueuePoolTest(PoolTestBase):
assert t < 14, "Not all timeouts were < 14 seconds %r" % timeouts
def _test_overflow(self, thread_count, max_overflow):
- gc_collect()
+ reaper = testing.engines.ConnectionKiller()
dbapi = MockDBAPI()
mutex = threading.Lock()
@@ -850,6 +852,7 @@ class QueuePoolTest(PoolTestBase):
p = pool.QueuePool(
creator=creator, pool_size=3, timeout=2, max_overflow=max_overflow
)
+ reaper.add_pool(p)
peaks = []
def whammy():
@@ -873,8 +876,7 @@ class QueuePoolTest(PoolTestBase):
self.assert_(max(peaks) <= max_overflow)
- lazy_gc()
- assert not pool._refs
+ reaper.assert_all_closed()
def test_overflow_reset_on_failed_connect(self):
dbapi = Mock()