mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-06 04:56:54 +00:00
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.
This commit is contained in:
parent
c9209507a8
commit
594c16abb4
3 changed files with 26 additions and 16 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue