From a7246fa82320b51d2295f609409069dcac3b15ca Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Sat, 13 Apr 2013 04:18:07 +0900 Subject: [PATCH] Use `as` keyword instead of comma for exception catches --- alembic/config.py | 2 +- tests/__init__.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/alembic/config.py b/alembic/config.py index cf667b96..bd56e509 100644 --- a/alembic/config.py +++ b/alembic/config.py @@ -247,7 +247,7 @@ class CommandLine(object): *[getattr(options, k) for k in positional], **dict((k, getattr(options, k)) for k in kwarg) ) - except util.CommandError, e: + except util.CommandError as e: util.err(str(e)) def main(self, argv=None): diff --git a/tests/__init__.py b/tests/__init__.py index 83d5825a..87f8b1d0 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -60,11 +60,11 @@ def db_for_dialect(name): raise SkipTest("No dialect %r in test.cfg" % name) try: eng = create_engine(cfg) - except ImportError, er1: + except ImportError as er1: raise SkipTest("Can't import DBAPI: %s" % er1) try: conn = eng.connect() - except SQLAlchemyError, er2: + except SQLAlchemyError as er2: raise SkipTest("Can't connect to database: %s" % er2) _engs[name] = eng return eng @@ -144,7 +144,7 @@ def assert_raises_message(except_cls, msg, callable_, *args, **kwargs): try: callable_(*args, **kwargs) assert False, "Callable did not raise an exception" - except except_cls, e: + except except_cls as e: assert re.search(msg, str(e)), "%r !~ %s" % (msg, e) print str(e) -- 2.47.2