config: Add 'config_file' parameter to ConfigFileFinder

The `--config` flag is passed into `MergedConfigParser.parse()` and the
module-level function `config.get_local_plugins()`.  Since both of these
places utilize the `ConfigFileFinder` object and the configuration file
override pertains to how configuration behaves, this incremental change
directly associates the `ConfigFileFinder` and the configuration file
override.
This commit is contained in:
Eric N. Vander Weele 2020-01-12 14:41:20 -08:00
parent 24c2693979
commit 153032f778
3 changed files with 30 additions and 3 deletions

View file

@ -127,6 +127,23 @@ def test_read_config_catches_decoding_errors(tmpdir):
assert parsed == []
def test_config_file_default_value():
"""Verify the default 'config_file' attribute value."""
finder = config.ConfigFileFinder('flake8', [])
assert finder.config_file is None
def test_setting_config_file_value():
"""Verify the 'config_file' attribute matches constructed value."""
config_file_value = 'flake8.ini'
finder = config.ConfigFileFinder(
'flake8',
[],
config_file=config_file_value,
)
assert finder.config_file == config_file_value
def test_ignore_config_files_default_value():
"""Verify the default 'ignore_config_files' attribute value."""
finder = config.ConfigFileFinder('flake8', [])