From 1394f3929b61f206a6f24af1bccba5a5a4b402d5 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Tue, 12 Nov 2013 23:17:50 +0100 Subject: [PATCH] commands: Add run method to Commands --- mopidy/utils/command.py | 3 +++ tests/utils/command_test.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/mopidy/utils/command.py b/mopidy/utils/command.py index 7c6e874b..d8b5bbf6 100644 --- a/mopidy/utils/command.py +++ b/mopidy/utils/command.py @@ -127,3 +127,6 @@ class Command(object): return self._children[child]._parse( result._args, result, defaults, ' '.join([prog, child])) + + def run(self, *args, **kwargs): + raise NotImplementedError diff --git a/tests/utils/command_test.py b/tests/utils/command_test.py index 016de37f..7c2e3112 100644 --- a/tests/utils/command_test.py +++ b/tests/utils/command_test.py @@ -434,3 +434,9 @@ class CommandErrorTest(unittest.TestCase): def test_str_command_error(self): error = command.CommandError('message', usage='usage: foo') self.assertEqual(str(error), 'usage: foo\n\nerror: message\n') + + +class RunTest(unittest.TestCase): + def test_default_implmentation_raises_error(self): + with self.assertRaises(NotImplementedError): + command.Command().run()