summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-01-16 01:22:03 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2021-01-16 01:22:03 +0000
commit3c15c32ce834655ff92983465cf937d02aa1584f (patch)
tree7d7569d2476ec926082e2c2f5751abf2f1c1de72 /lib/sqlalchemy/testing
parent3e40a232a025b770488c9d4940d284e3f7cdba24 (diff)
parent44034f19ac27ccd4a0e57dfa3d2d6b494dc9b133 (diff)
downloadsqlalchemy-3c15c32ce834655ff92983465cf937d02aa1584f.tar.gz
Merge "Create explicit GC ordering between ConnectionFairy/ConnectionRecord"
Diffstat (limited to 'lib/sqlalchemy/testing')
-rw-r--r--lib/sqlalchemy/testing/engines.py14
-rw-r--r--lib/sqlalchemy/testing/plugin/plugin_base.py1
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/engines.py b/lib/sqlalchemy/testing/engines.py
index 8b334fde2..a313c298a 100644
--- a/lib/sqlalchemy/testing/engines.py
+++ b/lib/sqlalchemy/testing/engines.py
@@ -14,6 +14,7 @@ import weakref
from . import config
from .util import decorator
+from .util import gc_collect
from .. import event
from .. import pool
@@ -124,6 +125,19 @@ class ConnectionKiller(object):
self._drop_testing_engines("function")
self._drop_testing_engines("class")
+ def stop_test_class_outside_fixtures(self):
+ # ensure no refs to checked out connections at all.
+
+ if pool.base._strong_ref_connection_records:
+ gc_collect()
+
+ if pool.base._strong_ref_connection_records:
+ ln = len(pool.base._strong_ref_connection_records)
+ pool.base._strong_ref_connection_records.clear()
+ assert (
+ False
+ ), "%d connection recs not cleared after test suite" % (ln)
+
def final_cleanup(self):
self.checkin_all()
for scope in self.testing_engines:
diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py
index 7851fbb3e..858814f91 100644
--- a/lib/sqlalchemy/testing/plugin/plugin_base.py
+++ b/lib/sqlalchemy/testing/plugin/plugin_base.py
@@ -586,6 +586,7 @@ def stop_test_class(cls):
def stop_test_class_outside_fixtures(cls):
+ engines.testing_reaper.stop_test_class_outside_fixtures()
provision.stop_test_class_outside_fixtures(config, config.db, cls)
try:
if not options.low_connections: