summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-07-29 17:49:39 +0000
committerIan Cordasco <graffatcolmingov@gmail.com>2016-07-29 17:49:39 +0000
commit971dcc16f081203ec0374c50a75b84d8cc089025 (patch)
tree8664f3f302c50928cfbd93aec7f6d099afba2636
parent87c488b9ccea4403df9296f56f051b1303aa9cd9 (diff)
parent78edfdea638e4caea2882351f23a2f9f397d2226 (diff)
downloadflake8-971dcc16f081203ec0374c50a75b84d8cc089025.tar.gz
Merge branch 'test-non-callable' into 'master'
Test loading non-callable plugins *Description of changes* This is just a simple addition to prevent a regression regarding bug #164 and merge request !101. *Related to:* #164, !101 See merge request !106
-rw-r--r--tests/unit/test_plugin.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/test_plugin.py b/tests/unit/test_plugin.py
index f69bc05..2cc0645 100644
--- a/tests/unit/test_plugin.py
+++ b/tests/unit/test_plugin.py
@@ -62,6 +62,17 @@ def test_load_plugin_catches_and_reraises_exceptions():
plugin.load_plugin()
+def test_load_noncallable_plugin():
+ """Verify that we do not load a non-callable plugin."""
+ entry_point = mock.Mock(spec=['require', 'resolve', 'load'])
+ entry_point.resolve.return_value = mock.NonCallableMock()
+ plugin = manager.Plugin('T000', entry_point)
+
+ with pytest.raises(exceptions.FailedToLoadPlugin):
+ plugin.load_plugin()
+ entry_point.resolve.assert_called_once_with()
+
+
def test_plugin_property_loads_plugin_on_first_use():
"""Verify that we load our plugin when we first try to use it."""
entry_point = mock.Mock(spec=['require', 'resolve', 'load'])