diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-03-15 18:01:23 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-03-15 18:01:23 -0400 |
commit | edbb32649960db29761e765fc74c025e9999c7dd (patch) | |
tree | 5f4ff3d8d7bc095f86c7f30b5cd584b927a08dd2 | |
parent | 4d147c3b169a3d57c0528b0a2633a30866fcb2f9 (diff) | |
download | sqlalchemy-edbb32649960db29761e765fc74c025e9999c7dd.tar.gz |
- ensure engine is restored even if we had a failure in cleanup
for stray connection
-rw-r--r-- | lib/sqlalchemy/testing/plugin/plugin_base.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index 22b79d1b3..fd33c56a0 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(): |