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_0_13~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c2515c80fb29dff28667730c19914e81ca7dd90;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - ensure engine is restored even if we had a failure in cleanup for stray connection (cherry picked from commit edbb32649960db29761e765fc74c025e9999c7dd) --- diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index 84258df922..1ba0a800f5 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -427,9 +427,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():