Deprecated warning for SafeConfigParser
tox -e py34 is reporting a deprecation warning for SafeConfigParser /octavia/.tox/py34/lib/python3.4/site-packages/pbr/util.py:207: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead. parser = configparser.SafeConfigParser() Closes-Bug: #1618666 Change-Id: Ib280b778938b64717ee1cf94efae2f7b553c8f5e
This commit is contained in:
parent
8d64858523
commit
77d9ab7d07
|
@ -17,6 +17,7 @@ import textwrap
|
|||
|
||||
import six
|
||||
from six.moves import configparser
|
||||
import sys
|
||||
|
||||
from pbr.tests import base
|
||||
from pbr import util
|
||||
|
@ -61,7 +62,10 @@ class TestExtrasRequireParsingScenarios(base.BaseTestCase):
|
|||
|
||||
def config_from_ini(self, ini):
|
||||
config = {}
|
||||
parser = configparser.SafeConfigParser()
|
||||
if sys.version_info >= (3, 2):
|
||||
parser = configparser.ConfigParser()
|
||||
else:
|
||||
parser = configparser.SafeConfigParser()
|
||||
ini = textwrap.dedent(six.u(ini))
|
||||
parser.readfp(io.StringIO(ini))
|
||||
for section in parser.sections():
|
||||
|
|
|
@ -42,6 +42,7 @@ import contextlib
|
|||
import os
|
||||
import shutil
|
||||
import stat
|
||||
import sys
|
||||
|
||||
try:
|
||||
import ConfigParser as configparser
|
||||
|
@ -51,7 +52,10 @@ except ImportError:
|
|||
|
||||
@contextlib.contextmanager
|
||||
def open_config(filename):
|
||||
cfg = configparser.SafeConfigParser()
|
||||
if sys.version_info >= (3, 2):
|
||||
cfg = configparser.ConfigParser()
|
||||
else:
|
||||
cfg = configparser.SafeConfigParser()
|
||||
cfg.read(filename)
|
||||
yield cfg
|
||||
with open(filename, 'w') as fp:
|
||||
|
|
|
@ -204,7 +204,10 @@ def cfg_to_args(path='setup.cfg', script_args=()):
|
|||
"""
|
||||
|
||||
# The method source code really starts here.
|
||||
parser = configparser.SafeConfigParser()
|
||||
if sys.version_info >= (3, 2):
|
||||
parser = configparser.ConfigParser()
|
||||
else:
|
||||
parser = configparser.SafeConfigParser()
|
||||
if not os.path.exists(path):
|
||||
raise DistutilsFileError("file '%s' does not exist" %
|
||||
os.path.abspath(path))
|
||||
|
|
Loading…
Reference in New Issue