From: Hong Minhee Date: Fri, 12 Apr 2013 19:33:15 +0000 (+0900) Subject: ConfigParser renamed to configparser since Python 3 X-Git-Tag: rel_0_6_0~22^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ab2498bce7464426aaabaadd9925b9efba7237c;p=thirdparty%2Fsqlalchemy%2Falembic.git ConfigParser renamed to configparser since Python 3 --- diff --git a/alembic/config.py b/alembic/config.py index bd56e509..e6b09d2e 100644 --- a/alembic/config.py +++ b/alembic/config.py @@ -1,5 +1,8 @@ from argparse import ArgumentParser -import ConfigParser +try: + import configparser +except ImportError: + import ConfigParser as configparser import inspect import os import sys @@ -91,7 +94,7 @@ class Config(object): here = os.path.abspath(os.path.dirname(self.config_file_name)) else: here = "" - file_config = ConfigParser.SafeConfigParser({'here': here}) + file_config = configparser.SafeConfigParser({'here': here}) if self.config_file_name: file_config.read([self.config_file_name]) else: diff --git a/tests/__init__.py b/tests/__init__.py index 97737fdc..f7bcdcdd 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -32,7 +32,7 @@ from alembic.ddl.impl import _impls staging_directory = os.path.join(os.path.dirname(__file__), 'scratch') files_directory = os.path.join(os.path.dirname(__file__), 'files') -testing_config = ConfigParser.ConfigParser() +testing_config = configparser.ConfigParser() testing_config.read(['test.cfg']) def sqlite_db(): @@ -56,7 +56,7 @@ def db_for_dialect(name): else: try: cfg = testing_config.get("db", name) - except ConfigParser.NoOptionError: + except configparser.NoOptionError: raise SkipTest("No dialect %r in test.cfg" % name) try: eng = create_engine(cfg)