summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorEric N. Vander Weele <ericvw@gmail.com>2020-01-12 15:13:41 -0800
committerEric N. Vander Weele <ericvw@gmail.com>2020-01-12 23:19:26 -0500
commit77b2506071bec65d75e5259e00ceefb91ae50cf1 (patch)
treeba1ab41f0d9e4f422a00649b98c98c120ed7771c /tests/unit
parent153032f778d609b206cbfdb56ddf27e6f46925c4 (diff)
downloadflake8-77b2506071bec65d75e5259e00ceefb91ae50cf1.tar.gz
config: Switch code paths to use 'ConfigFileFinder.config_file'
Now that the `ConfigFileFinder` has the `.config_file` attribute, switch the relevant code paths to utilize this public attribute. Tests have been updated to either construct `ConfigFileFinder` or mock the object appropriately.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_get_local_plugins.py6
-rw-r--r--tests/unit/test_merged_config_parser.py6
2 files changed, 8 insertions, 4 deletions
diff --git a/tests/unit/test_get_local_plugins.py b/tests/unit/test_get_local_plugins.py
index 6311677..2a23d7a 100644
--- a/tests/unit/test_get_local_plugins.py
+++ b/tests/unit/test_get_local_plugins.py
@@ -24,10 +24,12 @@ def test_get_local_plugins_uses_cli_config():
config_finder.cli_config.return_value = config_obj
config_finder.ignore_config_files = False
config_obj.get.return_value = ''
+ config_file_value = 'foo.ini'
+ config_finder.config_file = config_file_value
- config.get_local_plugins(config_finder, cli_config='foo.ini')
+ config.get_local_plugins(config_finder, cli_config=config_file_value)
- config_finder.cli_config.assert_called_once_with('foo.ini')
+ config_finder.cli_config.assert_called_once_with(config_file_value)
def test_get_local_plugins():
diff --git a/tests/unit/test_merged_config_parser.py b/tests/unit/test_merged_config_parser.py
index f2d70d9..3881699 100644
--- a/tests/unit/test_merged_config_parser.py
+++ b/tests/unit/test_merged_config_parser.py
@@ -155,12 +155,14 @@ def test_parse_isolates_config(optmanager):
def test_parse_uses_cli_config(optmanager):
"""Verify behaviour of the parse method with a specified config."""
+ config_file_value = 'foo.ini'
config_finder = mock.MagicMock()
+ config_finder.config_file = config_file_value
config_finder.ignore_config_files = False
parser = config.MergedConfigParser(optmanager, config_finder)
- parser.parse(cli_config='foo.ini')
- config_finder.cli_config.assert_called_once_with('foo.ini')
+ parser.parse(cli_config=config_file_value)
+ config_finder.cli_config.assert_called_once_with(config_file_value)
@pytest.mark.parametrize('config_fixture_path', [