summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-11-09 18:43:42 -0600
committerIan Cordasco <graffatcolmingov@gmail.com>2016-11-09 18:47:57 -0600
commit1dfd6bae771619386f7251c3c8281cbb81486b95 (patch)
tree0254c8120370032cc34e07c7ef2f43ba675beeaf /tests
parentca4f631fb2411d6f9fbf73ed10275ba8d19dd278 (diff)
downloadflake8-1dfd6bae771619386f7251c3c8281cbb81486b95.tar.gz
Actually remove enabled extensions from ignore list
When we enable a plugin (when it's provided in the --enable-extensions) plugin, we need to remove it both from the extended default ignore list and the plain ignore list. Closes #239
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_plugin.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/unit/test_plugin.py b/tests/unit/test_plugin.py
index 2cc0645..84f676a 100644
--- a/tests/unit/test_plugin.py
+++ b/tests/unit/test_plugin.py
@@ -162,3 +162,28 @@ def test_provide_options():
plugin_obj.parse_options.assert_called_once_with(
option_manager, option_values, None
)
+
+
+@pytest.mark.parametrize('ignore_list, code, expected_list', [
+ (['E', 'W', 'F', 'C9'], 'W', ['E', 'F', 'C9']),
+ (['E', 'W', 'F'], 'C9', ['E', 'W', 'F']),
+])
+def test_enable(ignore_list, code, expected_list):
+ """Verify that enabling a plugin removes it from the ignore list."""
+ options = mock.Mock(ignore=ignore_list)
+ optmanager = mock.Mock()
+ plugin = manager.Plugin(code, mock.Mock())
+
+ plugin.enable(optmanager, options)
+
+ assert options.ignore == expected_list
+
+
+def test_enable_without_providing_parsed_options():
+ """Verify that enabling a plugin removes it from the ignore list."""
+ optmanager = mock.Mock()
+ plugin = manager.Plugin('U4', mock.Mock())
+
+ plugin.enable(optmanager)
+
+ optmanager.remove_from_default_ignore.assert_called_once_with(['U4'])