runner.py 文件源码

python
阅读 103 收藏 0 点赞 0 评论 0

项目:ufolint 作者: source-foundry 项目源码 文件源码
def _validate_read_data_types_metainfo_plist(self):
        metainfo_plist_path = os.path.join(self.ufopath, 'metainfo.plist')
        res = Result(metainfo_plist_path)
        ss = StdStreamer(metainfo_plist_path)
        try:
            meta_dict = load(metainfo_plist_path)
            if 'formatVersion' in meta_dict.keys():
                if isinstance(meta_dict['formatVersion'], int):
                    res.test_failed = False
                    ss.stream_result(res)
                else:
                    res.test_failed = True
                    res.exit_failure = True  # early exit if fails
                    res.test_long_stdstream_string = metainfo_plist_path + " 'formatVersion' value must be specified as" \
                                                                           " an integer"
                    ss.stream_result(res)
            else:
                res.test_failed = True
                res.exit_failure = True  # early exit if fails
                res.test_long_stdstream_string = "Failed to read the 'formatVersion' value in " + metainfo_plist_path
                ss.stream_result(res)
        except Exception as e:
            res.test_failed = True
            res.exit_failure = True  # early exit if fails
            res.test_long_stdstream_string = "Failed to read the 'formatVersion' value in " \
                                             "the file " + metainfo_plist_path + ". Error: " + str(e)
            ss.stream_result(res)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号