diff options
author | ndparker <ndparker@users.noreply.github.com> | 2014-09-23 23:28:11 +0200 |
---|---|---|
committer | ndparker <ndparker@users.noreply.github.com> | 2014-09-23 23:28:11 +0200 |
commit | ce52dd9e3b71f2074d7821fe62803d4e0eefe512 (patch) | |
tree | f0f9356075b7d85469a98180d17a5e2c91c058e5 /lib/sqlalchemy/testing/provision.py | |
parent | 360477cc3af826b5056039b9a19ec3ecb2b94ede (diff) | |
download | sqlalchemy-ce52dd9e3b71f2074d7821fe62803d4e0eefe512.tar.gz |
improve exception vs. exit handling
Diffstat (limited to 'lib/sqlalchemy/testing/provision.py')
-rw-r--r-- | lib/sqlalchemy/testing/provision.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/provision.py b/lib/sqlalchemy/testing/provision.py index 0bcdad959..64688d6b5 100644 --- a/lib/sqlalchemy/testing/provision.py +++ b/lib/sqlalchemy/testing/provision.py @@ -120,6 +120,8 @@ def _pg_create_db(cfg, eng, ident): isolation_level="AUTOCOMMIT") as conn: try: _pg_drop_db(cfg, conn, ident) + except (SystemExit, KeyboardInterrupt): + raise except: pass currentdb = conn.scalar("select current_database()") @@ -131,6 +133,8 @@ def _mysql_create_db(cfg, eng, ident): with eng.connect() as conn: try: _mysql_drop_db(cfg, conn, ident) + except (SystemExit, KeyboardInterrupt): + raise except: pass conn.execute("CREATE DATABASE %s" % ident) @@ -173,14 +177,20 @@ def _mysql_drop_db(cfg, eng, ident): with eng.connect() as conn: try: conn.execute("DROP DATABASE %s_test_schema" % ident) + except (SystemExit, KeyboardInterrupt): + raise except: pass try: conn.execute("DROP DATABASE %s_test_schema_2" % ident) + except (SystemExit, KeyboardInterrupt): + raise except: pass try: conn.execute("DROP DATABASE %s" % ident) + except (SystemExit, KeyboardInterrupt): + raise except: pass |