Merge branch 'fix-quiet'

This commit is contained in:
Ian Stapleton Cordasco 2017-07-27 18:44:39 -05:00
commit a0dabc1d42
No known key found for this signature in database
GPG key ID: C9D7A2604B4FCB2A
3 changed files with 25 additions and 4 deletions

View file

@ -183,7 +183,8 @@ class MergedConfigParser(object):
# Use the appropriate method to parse the config value
method = config_parser.get
if option.type in self.GETINT_TYPES:
if (option.type in self.GETINT_TYPES or
option.action in self.GETINT_TYPES):
method = config_parser.getint
elif option.action in self.GETBOOL_ACTIONS:
method = config_parser.getboolean

View file

@ -7,3 +7,5 @@ exclude =
foo/,
bar/,
bogus/
verbose = 2
quiet = 1

View file

@ -47,6 +47,10 @@ def test_parse_cli_config(optmanager):
normalize_paths=True)
optmanager.add_option('--ignore', parse_from_config=True,
comma_separated_list=True)
optmanager.add_option('--verbose', parse_from_config=True,
action='count')
optmanager.add_option('--quiet', parse_from_config=True,
action='count')
parser = config.MergedConfigParser(optmanager)
parsed_config = parser.parse_cli_config(
@ -58,7 +62,9 @@ def test_parse_cli_config(optmanager):
os.path.abspath('foo/'),
os.path.abspath('bar/'),
os.path.abspath('bogus/'),
]
],
'verbose': 2,
'quiet': 1,
}
@ -81,6 +87,10 @@ def test_parse_user_config(optmanager):
normalize_paths=True)
optmanager.add_option('--ignore', parse_from_config=True,
comma_separated_list=True)
optmanager.add_option('--verbose', parse_from_config=True,
action='count')
optmanager.add_option('--quiet', parse_from_config=True,
action='count')
parser = config.MergedConfigParser(optmanager)
with mock.patch.object(parser.config_finder, 'user_config_file') as usercf:
@ -93,7 +103,9 @@ def test_parse_user_config(optmanager):
os.path.abspath('foo/'),
os.path.abspath('bar/'),
os.path.abspath('bogus/'),
]
],
'verbose': 2,
'quiet': 1,
}
@ -104,6 +116,10 @@ def test_parse_local_config(optmanager):
normalize_paths=True)
optmanager.add_option('--ignore', parse_from_config=True,
comma_separated_list=True)
optmanager.add_option('--verbose', parse_from_config=True,
action='count')
optmanager.add_option('--quiet', parse_from_config=True,
action='count')
parser = config.MergedConfigParser(optmanager)
config_finder = parser.config_finder
@ -119,7 +135,9 @@ def test_parse_local_config(optmanager):
os.path.abspath('foo/'),
os.path.abspath('bar/'),
os.path.abspath('bogus/'),
]
],
'verbose': 2,
'quiet': 1,
}