def _parse_one(self, arg): try: return commands._find_command(arg) except KeyError: raise CustomError("Could not find command '%s'." % arg)
def test_looksupcommand(self): cmd = commands._find_command('foo-bar') self.assertIsInstance(cmd(None), commands.Command)
def test_sets_name(self): cmd = commands._find_command('foo-bar') # The name is preserved, so that 'testr commands' shows something # sensible. self.assertEqual('foo-bar', cmd.name)
def test_missing_command(self): self.assertThat(lambda: commands._find_command('bar'), raises(KeyError))
def test_sets_name(self): cmd = commands._find_command('foo') self.assertEqual('foo', cmd.name)