From: Mike Bayer Date: Tue, 15 Mar 2016 22:01:23 +0000 (-0400) Subject: - ensure engine is restored even if we had a failure in cleanup X-Git-Tag: rel_1_1_0b1~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edbb32649960db29761e765fc74c025e9999c7dd;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - ensure engine is restored even if we had a failure in cleanup for stray connection --- diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index 22b79d1b32..fd33c56a0c 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -428,9 +428,11 @@ def stop_test_class(cls): #from sqlalchemy import inspect #assert not inspect(testing.db).get_table_names() engines.testing_reaper._stop_test_ctx() - if not options.low_connections: - assertions.global_cleanup_assertions() - _restore_engine() + try: + if not options.low_connections: + assertions.global_cleanup_assertions() + finally: + _restore_engine() def _restore_engine():