mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-07 21:44:18 +00:00
parent
6df26ffd57
commit
4e58068657
15 changed files with 391 additions and 133 deletions
38
tests/unit/test_get_local_plugins.py
Normal file
38
tests/unit/test_get_local_plugins.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
"""Tests for get_local_plugins."""
|
||||
import mock
|
||||
|
||||
from flake8.options import config
|
||||
|
||||
|
||||
def test_get_local_plugins_respects_isolated():
|
||||
"""Verify behaviour of get_local_plugins with isolated=True."""
|
||||
config_finder = mock.MagicMock()
|
||||
|
||||
local_plugins = config.get_local_plugins(config_finder, isolated=True)
|
||||
|
||||
assert local_plugins.extension == []
|
||||
assert local_plugins.report == []
|
||||
assert config_finder.local_configs.called is False
|
||||
assert config_finder.user_config.called is False
|
||||
|
||||
|
||||
def test_get_local_plugins_uses_cli_config():
|
||||
"""Verify behaviour of get_local_plugins with a specified config."""
|
||||
config_finder = mock.MagicMock()
|
||||
|
||||
config.get_local_plugins(config_finder, cli_config='foo.ini')
|
||||
|
||||
config_finder.cli_config.assert_called_once_with('foo.ini')
|
||||
|
||||
|
||||
def test_get_local_plugins():
|
||||
"""Verify get_local_plugins returns expected plugins."""
|
||||
config_fixture_path = 'tests/fixtures/config_files/local-plugin.ini'
|
||||
config_finder = config.ConfigFileFinder('flake8', [], [])
|
||||
|
||||
with mock.patch.object(config_finder, 'local_config_files') as localcfs:
|
||||
localcfs.return_value = [config_fixture_path]
|
||||
local_plugins = config.get_local_plugins(config_finder)
|
||||
|
||||
assert local_plugins.extension == ['XE = test_plugins:ExtensionTestPlugin']
|
||||
assert local_plugins.report == ['XR = test_plugins:ReportTestPlugin']
|
||||
Loading…
Add table
Add a link
Reference in a new issue