From: Hong Minhee Date: Fri, 12 Apr 2013 19:18:07 +0000 (+0900) Subject: Use `as` keyword instead of comma for exception catches X-Git-Tag: rel_0_6_0~22^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7246fa82320b51d2295f609409069dcac3b15ca;p=thirdparty%2Fsqlalchemy%2Falembic.git Use `as` keyword instead of comma for exception catches --- 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)