commands: Add run method to Commands
This commit is contained in:
parent
f5a5f9e9b1
commit
1394f3929b
@ -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
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user