summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-04-20 12:16:37 +0100
committerLars Wirzenius <liw@liw.fi>2014-04-20 12:16:37 +0100
commitb64ab66f72ef5688336ad3f4f72e2cb220509af0 (patch)
treea6e76d7ec1cfc463a4ea8bc5fbb53150c54f8a44
parent0d75e6760fe5c8ec63b0893c936e1ec485204394 (diff)
downloadcliapp-b64ab66f72ef5688336ad3f4f72e2cb220509af0.tar.gz
Make Plugin.disable be a no-op
-rw-r--r--NEWS4
-rw-r--r--cliapp/plugin.py5
-rw-r--r--cliapp/plugin_tests.py3
3 files changed, 6 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index abd35e3..5aa16b9 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,10 @@ Version UNRELEASED
`setup_logging_formatter_for_file`, and
`setup_logging_formatter_for_syslog`.
+* Plugins no longer need to define a `disable` method: the default
+ implementation is now a no-op, instead of raising
+ `NotImplementedError`.
+
Bug fixes:
* When getting help for a subcommand, cliapp would crash saying
diff --git a/cliapp/plugin.py b/cliapp/plugin.py
index c6ea66f..ac8ea0b 100644
--- a/cliapp/plugin.py
+++ b/cliapp/plugin.py
@@ -119,7 +119,6 @@ class Plugin(object):
'''Enable the plugin.'''
raise NotImplemented()
- def disable(self):
+ def disable(self): # pragma: no cover
'''Disable the plugin.'''
- raise NotImplemented()
-
+ pass
diff --git a/cliapp/plugin_tests.py b/cliapp/plugin_tests.py
index 8c98039..381e7c4 100644
--- a/cliapp/plugin_tests.py
+++ b/cliapp/plugin_tests.py
@@ -40,9 +40,6 @@ class PluginTests(unittest.TestCase):
def test_enable_raises_exception(self):
self.assertRaises(Exception, self.plugin.enable)
- def test_disable_raises_exception(self):
- self.assertRaises(Exception, self.plugin.disable)
-
def test_enable_wrapper_calls_enable(self):
self.plugin.enable = lambda: setattr(self, 'enabled', True)
self.plugin.enable_wrapper()