application: Change make_config_finder to be a pure static method

This change makes `Application.make_config_finder` to be side-effect
free where it its return value is only determined by its input values.
This commit is contained in:
Eric N. Vander Weele 2019-11-05 15:15:00 +08:00
parent 19868e5c21
commit d75088b199
3 changed files with 18 additions and 8 deletions

View file

@ -19,13 +19,14 @@ def test_get_style_guide():
)
mockedapp = mock.Mock()
mockedapp.parse_preliminary_options.return_value = (prelim_opts, [])
mockedapp.program = 'flake8'
with mock.patch('flake8.main.application.Application') as application:
application.return_value = mockedapp
style_guide = api.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.make_config_finder.assert_called_once_with(mockedapp.program, [])
mockedapp.find_plugins.assert_called_once_with(None, False)
mockedapp.register_plugin_options.assert_called_once_with()
mockedapp.parse_configuration_and_cli.assert_called_once_with([])