From 8ab2498bce7464426aaabaadd9925b9efba7237c Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Sat, 13 Apr 2013 04:33:15 +0900 Subject: [PATCH] ConfigParser renamed to configparser since Python 3 --- alembic/config.py | 7 +++++-- tests/__init__.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) 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) -- 2.47.2