示例#1
0
def main():
    """
    program entry point
    """
    parser = create_parser()
    options = vars(parser.parse_args())
    HASH_STORE.IGNORE_CACHE_FILE = options[constants.LABEL_FORCE]
    moban_file = options[constants.LABEL_MOBANFILE]
    if moban_file is None:
        moban_file = mobanfile.find_default_moban_file()
    if moban_file:
        try:
            count = handle_moban_file(moban_file, options)
            if count:
                sys.exit(count)
        except (
                exceptions.DirectoryNotFound,
                exceptions.NoThirdPartyEngine,
                exceptions.MobanfileGrammarException,
        ) as e:
            reporter.report_error_message(str(e))
            sys.exit(constants.ERROR)
    else:
        try:
            count = handle_command_line(options)
            if count:
                sys.exit(count)
        except exceptions.NoTemplate as e:
            reporter.report_error_message(str(e))
            sys.exit(constants.ERROR)
示例#2
0
    def test_no_moban_file(self):
        self.fake_file_existence.side_effect = [False, False]
        from moban.mobanfile import find_default_moban_file

        actual = find_default_moban_file()
        assert actual is None
示例#3
0
    def test_moban_yaml(self):
        self.fake_file_existence.side_effect = [False, True]
        from moban.mobanfile import find_default_moban_file

        actual = find_default_moban_file()
        eq_(".moban.yaml", actual)
示例#4
0
    def test_moban_yml(self):
        self.fake_file_existence.return_value = True
        from moban.mobanfile import find_default_moban_file

        actual = find_default_moban_file()
        eq_(".moban.yml", actual)