diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-28 22:29:45 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-28 22:29:45 -0400 |
commit | 83f3dbc83d1066216084a01b32cddcc090f697d5 (patch) | |
tree | f71f95f8e823b115863e8d456226ce5558db5778 /lib/sqlalchemy/testing/engines.py | |
parent | bccf8ff5b1b17fd093308b40e726051256ec14ae (diff) | |
download | sqlalchemy-83f3dbc83d1066216084a01b32cddcc090f697d5.tar.gz |
improve the close handling here so that we don't double-close a connection;
we log this now so it apparently happens a bunch
Diffstat (limited to 'lib/sqlalchemy/testing/engines.py')
-rw-r--r-- | lib/sqlalchemy/testing/engines.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sqlalchemy/testing/engines.py b/lib/sqlalchemy/testing/engines.py index d8c1709e7..29c8b6a03 100644 --- a/lib/sqlalchemy/testing/engines.py +++ b/lib/sqlalchemy/testing/engines.py @@ -21,7 +21,7 @@ class ConnectionKiller(object): self.testing_engines[engine] = True def connect(self, dbapi_conn, con_record): - self.conns.add(dbapi_conn) + self.conns.add((dbapi_conn, con_record)) def checkout(self, dbapi_con, con_record, con_proxy): self.proxy_refs[con_proxy] = True @@ -52,7 +52,7 @@ class ConnectionKiller(object): # is collecting in finalize_fairy, deadlock. # not sure if this should be if pypy/jython only. # note that firebird/fdb definitely needs this though - for conn in self.conns: + for conn, rec in self.conns: self._safe(conn.rollback) def _stop_test_ctx(self): @@ -72,8 +72,10 @@ class ConnectionKiller(object): def _stop_test_ctx_aggressive(self): self.close_all() - for conn in self.conns: + for conn, rec in self.conns: self._safe(conn.close) + rec.connection = None + self.conns = set() for rec in list(self.testing_engines): rec.dispose() |