summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorEric N. Vander Weele <ericvw@gmail.com>2019-11-09 09:55:01 +0800
committerEric N. Vander Weele <ericvw@gmail.com>2019-11-22 11:04:40 -0500
commit594c16abb42ef89e36db1701d5f1aa860f4db68d (patch)
tree9b7d79caab28e834d582abeae467f6b45b4a6e71 /tests/unit
parentc9209507a89ef8ff96cdb01af1b0937b6ec42402 (diff)
downloadflake8-594c16abb42ef89e36db1701d5f1aa860f4db68d.tar.gz
application: Remove configuration finder state
This change removes the `.config_finder` object from the `Application`. Since the configuration finder is only needed during initialization, we constrain the finder to be returned and passed to other methods necessary for initialization.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_legacy_api.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/unit/test_legacy_api.py b/tests/unit/test_legacy_api.py
index 77d9020..026fdc3 100644
--- a/tests/unit/test_legacy_api.py
+++ b/tests/unit/test_legacy_api.py
@@ -6,6 +6,7 @@ import pytest
from flake8.api import legacy as api
from flake8.formatting import base as formatter
+from flake8.options.config import ConfigFileFinder
def test_get_style_guide():
@@ -20,6 +21,8 @@ def test_get_style_guide():
mockedapp = mock.Mock()
mockedapp.parse_preliminary_options.return_value = (prelim_opts, [])
mockedapp.program = 'flake8'
+ config_finder = ConfigFileFinder(mockedapp.program, [])
+ mockedapp.make_config_finder.return_value = config_finder
with mock.patch('flake8.main.application.Application') as application:
application.return_value = mockedapp
style_guide = api.get_style_guide()
@@ -27,9 +30,10 @@ def test_get_style_guide():
application.assert_called_once_with()
mockedapp.parse_preliminary_options.assert_called_once_with([])
mockedapp.make_config_finder.assert_called_once_with(mockedapp.program, [])
- mockedapp.find_plugins.assert_called_once_with(None, False)
+ mockedapp.find_plugins.assert_called_once_with(config_finder, None, False)
mockedapp.register_plugin_options.assert_called_once_with()
- mockedapp.parse_configuration_and_cli.assert_called_once_with([])
+ mockedapp.parse_configuration_and_cli.assert_called_once_with(
+ config_finder, [])
mockedapp.make_formatter.assert_called_once_with()
mockedapp.make_guide.assert_called_once_with()
mockedapp.make_file_checker_manager.assert_called_once_with()