def it_can_configure_the_command_line_parser(self, Command_, command_cls_, command_, command_parser_): # exercise --------------------- parser = Command.parser() # verify ----------------------- # return value of add_subparsers is a messy tuple, accept ANY command_cls_.add_command_parser_to.assert_called_once_with(ANY) command_cls_.assert_called_once_with(command_parser_) command_parser_.set_defaults.assert_called_once_with(command=command_) assert isinstance(parser, argparse.ArgumentParser)
def it_should_raise_if_execute_not_implemented_on_subclass(self): command = Command(None) with pytest.raises(NotImplementedError): command.execute(None, None)