mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-06 04:56:54 +00:00
config: Remove checks for configs being previously parsed
Remove the checks to see if a configuration file has already been seen and parsed. These checks aren't necessary because the entire run of `flake8` calls these methods *only* once per configuration provided.
This commit is contained in:
parent
d583f051ed
commit
716db1167e
2 changed files with 13 additions and 54 deletions
|
|
@ -34,18 +34,6 @@ def test_cli_config():
|
|||
assert parsed_config.has_section('flake8')
|
||||
|
||||
|
||||
def test_cli_config_double_read():
|
||||
"""Second request for CLI config is cached."""
|
||||
finder = config.ConfigFileFinder('flake8')
|
||||
|
||||
parsed_config = finder.cli_config(CLI_SPECIFIED_FILEPATH)
|
||||
boom = Exception("second request for CLI config not cached")
|
||||
with mock.patch.object(finder, '_read_config', side_effect=boom):
|
||||
parsed_config_2 = finder.cli_config(CLI_SPECIFIED_FILEPATH)
|
||||
|
||||
assert parsed_config is parsed_config_2
|
||||
|
||||
|
||||
@pytest.mark.parametrize('cwd,expected', [
|
||||
# Root directory of project
|
||||
(os.path.abspath('.'),
|
||||
|
|
@ -96,18 +84,6 @@ def test_local_configs():
|
|||
assert isinstance(finder.local_configs(), configparser.RawConfigParser)
|
||||
|
||||
|
||||
def test_local_configs_double_read():
|
||||
"""Second request for local configs is cached."""
|
||||
finder = config.ConfigFileFinder('flake8')
|
||||
|
||||
first_read = finder.local_configs()
|
||||
boom = Exception("second request for local configs not cached")
|
||||
with mock.patch.object(finder, '_read_config', side_effect=boom):
|
||||
second_read = finder.local_configs()
|
||||
|
||||
assert first_read is second_read
|
||||
|
||||
|
||||
@pytest.mark.parametrize('files', [
|
||||
[BROKEN_CONFIG_PATH],
|
||||
[CLI_SPECIFIED_FILEPATH, BROKEN_CONFIG_PATH],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue