Python 3 ConfigParser compatibility.
This commit is contained in:
parent
d311e90792
commit
25b78d6de4
2 changed files with 3 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from ConfigParser import SafeConfigParser
|
from ConfigParser import ConfigParser
|
||||||
|
|
||||||
|
|
||||||
CONFIG_SECTION_LOCATION = 'location'
|
CONFIG_SECTION_LOCATION = 'location'
|
||||||
|
@ -19,7 +19,7 @@ def parse_configuration(config_filename):
|
||||||
Given a config filename of the expected format, return the parse configuration as a tuple of
|
Given a config filename of the expected format, return the parse configuration as a tuple of
|
||||||
(LocationConfig, RetentionConfig). Raise if the format is not as expected.
|
(LocationConfig, RetentionConfig). Raise if the format is not as expected.
|
||||||
'''
|
'''
|
||||||
parser = SafeConfigParser()
|
parser = ConfigParser()
|
||||||
parser.read((config_filename,))
|
parser.read((config_filename,))
|
||||||
section_names = parser.sections()
|
section_names = parser.sections()
|
||||||
expected_section_names = CONFIG_FORMAT.keys()
|
expected_section_names = CONFIG_FORMAT.keys()
|
||||||
|
|
|
@ -8,7 +8,7 @@ def insert_mock_parser(section_names):
|
||||||
parser = flexmock()
|
parser = flexmock()
|
||||||
parser.should_receive('read')
|
parser.should_receive('read')
|
||||||
parser.should_receive('sections').and_return(section_names)
|
parser.should_receive('sections').and_return(section_names)
|
||||||
flexmock(module).SafeConfigParser = parser
|
flexmock(module).ConfigParser = parser
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue