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:32:43 -0400 |
| commit | fb8d23fb09a5a5dcdda4a846891220f15b202221 (patch) | |
| tree | 9c2daee88ef9b0b763cc5eeb65b79c8b5186d814 /lib/sqlalchemy/testing | |
| parent | f57fc6836f47598362247045c296c5b2c0182b6d (diff) | |
| download | sqlalchemy-fb8d23fb09a5a5dcdda4a846891220f15b202221.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')
| -rw-r--r-- | lib/sqlalchemy/testing/engines.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/sqlalchemy/testing/engines.py b/lib/sqlalchemy/testing/engines.py index 26f561016..7de29a2bb 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 @@ -51,9 +51,10 @@ class ConnectionKiller(object): # this can cause a deadlock with pg8000 - pg8000 acquires # prepared statment lock inside of rollback() - if async gc # is collecting in finalize_fairy, deadlock. - # not sure if this should be if pypy/jython only - #for conn in self.conns: - # self._safe(conn.rollback) + # not sure if this should be if pypy/jython only. + # note that firebird/fdb definitely needs this though + for conn, rec in self.conns: + self._safe(conn.rollback) def _stop_test_ctx(self): if config.options.low_connections: @@ -72,8 +73,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 self.testing_engines.keys(): rec.dispose() |
