mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-13 16:14:18 +00:00
Test loading non-callable plugins
With d234f22 it did not load plugins which aren't callable. This is adding a
basic test to it.
This commit is contained in:
parent
20c619f649
commit
78edfdea63
1 changed files with 11 additions and 0 deletions
|
|
@ -62,6 +62,17 @@ def test_load_plugin_catches_and_reraises_exceptions():
|
||||||
plugin.load_plugin()
|
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():
|
def test_plugin_property_loads_plugin_on_first_use():
|
||||||
"""Verify that we load our plugin when we first try to use it."""
|
"""Verify that we load our plugin when we first try to use it."""
|
||||||
entry_point = mock.Mock(spec=['require', 'resolve', 'load'])
|
entry_point = mock.Mock(spec=['require', 'resolve', 'load'])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue