diff options
| author | Fabian Neundorf <CommodoreFabianus@gmx.de> | 2016-07-29 16:58:12 +0000 |
|---|---|---|
| committer | Fabian Neundorf <CommodoreFabianus@gmx.de> | 2016-07-29 18:58:12 +0200 |
| commit | 78edfdea638e4caea2882351f23a2f9f397d2226 (patch) | |
| tree | a2f279292b7437ccd4151842e6d91fc3e6b4fc7f /tests | |
| parent | 20c619f649978ad99be7e43aa57e71e38d9ae9d2 (diff) | |
| download | flake8-78edfdea638e4caea2882351f23a2f9f397d2226.tar.gz | |
Test loading non-callable plugins
With d234f22 it did not load plugins which aren't callable. This is adding a
basic test to it.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/test_plugin.py | 11 |
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']) |
