From ce9c53fb2da526452dff1ccc4faad5c4a75050da Mon Sep 17 00:00:00 2001 From: wwx1101975 Date: Thu, 12 May 2022 15:12:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E7=A6=81=E4=BB=A3=E7=A0=81=E7=BC=BA?= =?UTF-8?q?=E9=99=B7=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ac/framework/ac.py | 4 +- src/build/build_rpm_package.py | 20 ++-- src/build/obs_repo_source.py | 3 +- src/build/osc_build_k8s.py | 1 - src/build/related_rpm_package.py | 6 +- src/jenkinsfile/openeuler_jenkins_test.py | 3 +- src/jobs/repo_mapping.py | 1 - src/logger.py | 2 +- src/proxy/git_proxy.py | 3 - src/proxy/requests_proxy.py | 1 - src/tools/obs_package_build_report.py | 4 +- src/utils/check_abi.py | 40 ++++--- src/utils/check_conf.py | 6 +- test/ac/acl/license/test_check_license.py | 18 +-- test/ac/acl/package_yaml/test_check_repo.py | 43 +++----- test/ac/acl/package_yaml/test_check_yaml.py | 116 +++++++++++--------- 16 files changed, 138 insertions(+), 133 deletions(-) diff --git a/src/ac/framework/ac.py b/src/ac/framework/ac.py index 8b981c7..3b0081c 100644 --- a/src/ac/framework/ac.py +++ b/src/ac/framework/ac.py @@ -129,7 +129,7 @@ class AC(object): logger.debug("%s not support check", repo) continue - # import module + # importing module module_path = check_element.get("module", "{}.check_{}".format(element, element)) # eg: spec.check_spec try: module = importlib.import_module("." + module_path, self._acl_package) @@ -138,7 +138,7 @@ class AC(object): logger.exception("import module %s exception, %s", module_path, exc) continue - # import entry + # importing entry entry_name = check_element.get("entry", "Check{}".format(element.capitalize())) try: entry = getattr(module, entry_name) diff --git a/src/build/build_rpm_package.py b/src/build/build_rpm_package.py index 0a9d5e2..e7cc013 100755 --- a/src/build/build_rpm_package.py +++ b/src/build/build_rpm_package.py @@ -45,12 +45,12 @@ class BuildRPMPackage(object): :param arch: :return: """ - package = self._rpm_packages["rpm"].get(self._repo) + package = self._rpm_packages.get("rpm").get(self._repo) if not package: # not exist return None - return os.path.join(self._rpmbuild_dir, "RPMS", package["arch"], package["fullname"]) + return os.path.join(self._rpmbuild_dir, "RPMS", package.get("arch"), package.get("fullname")) def main_package_in_repo(self, committer, arch, rpm_repo_url): """ @@ -76,12 +76,12 @@ class BuildRPMPackage(object): 返回debuginfo包在本地路径 :return: """ - package = self._rpm_packages["rpm"].get("{}-debuginfo".format(self._repo)) + package = self._rpm_packages.get("rpm").get("{}-debuginfo".format(self._repo)) if not package: # not exist return None - return os.path.join(self._rpmbuild_dir, "RPMS", package["arch"], package["fullname"]) + return os.path.join(self._rpmbuild_dir, "RPMS", package.get("arch"), package.get("fullname")) def debuginfo_package_in_repo(self, committer, arch, rpm_repo_url): """ @@ -121,15 +121,15 @@ class BuildRPMPackage(object): :param remote_url: 仓库远端地址 :return: """ - package = self._rpm_packages["rpm"].get(name) + package = self._rpm_packages.get("rpm").get(name) if not package: # not exist return None if arch == "noarch": - return os.path.join(remote_url, committer, name, arch, package["fullname"]) + return os.path.join(remote_url, committer, name, arch, package.get("fullname")) - return os.path.join(remote_url, committer, name, arch, "noarch", package["fullname"]) + return os.path.join(remote_url, committer, name, arch, "noarch", package.get("fullname")) def get_package_fullname(self, name): """ @@ -137,8 +137,8 @@ class BuildRPMPackage(object): :param name: :return: """ - package = self._rpm_packages["rpm"].get(name) - return package["fullname"] if package else name + package = self._rpm_packages.get("rpm").get(name) + return package.get("fullname") if package else name def get_srpm_path(self): """ @@ -197,5 +197,5 @@ class BuildRPMPackage(object): packages = self._rpm_packages.get("rpm", {}) for name in packages: - package = packages[name] + package = packages.get(name) yield name, os.path.join(self._rpmbuild_dir, "SRPMS", package["fullname"]) diff --git a/src/build/obs_repo_source.py b/src/build/obs_repo_source.py index dba3408..357a2cd 100644 --- a/src/build/obs_repo_source.py +++ b/src/build/obs_repo_source.py @@ -43,7 +43,8 @@ class OBSRepoSource(object): :return: """ if priority: - return "[{}]\nname={}\nbaseurl={}\nenabled=1\ngpgcheck=0\npriority={}\n".format(repo_id, repo_name, repo_baseurl, priority) + return "[{}]\nname={}\nbaseurl={}\nenabled=1\ngpgcheck=0\npriority={}\n".format( + repo_id, repo_name, repo_baseurl, priority) else: return "[{}]\nname={}\nbaseurl={}\nenabled=1\ngpgcheck=0\n".format(repo_id, repo_name,repo_baseurl) diff --git a/src/build/osc_build_k8s.py b/src/build/osc_build_k8s.py index e2943cb..3c77cd4 100755 --- a/src/build/osc_build_k8s.py +++ b/src/build/osc_build_k8s.py @@ -286,7 +286,6 @@ if "__main__" == __name__: dd.set_attr("spb.scm.result", "failed") dd.set_attr_etime("spb.scm.etime") dd.set_attr_etime("spb.job.etime") - #dd.set_attr("spb.job.result", "failed") # upload to es query = {"term": {"id": args.comment_id}} diff --git a/src/build/related_rpm_package.py b/src/build/related_rpm_package.py index 2752431..8a350ba 100755 --- a/src/build/related_rpm_package.py +++ b/src/build/related_rpm_package.py @@ -78,10 +78,10 @@ class RelatedRpms(object): for name in self._arch_names: download_req_addr = os.path.join(self._obs_repo_url, download_project_name, name) logging.info("downloading index of %s", download_req_addr) - subprocess.run("wget -t 5 -c {} -O {} > /dev/null 2>&1".format(download_req_addr, self._arch_names[name]), - shell=True) + subprocess.run("wget -t 5 -c {} -O {} > /dev/null 2>&1".format( + download_req_addr, self._arch_names.get(name)), shell=True) if not has_found: - with open(self._arch_names[name], "r") as fd: + with open(self._arch_names.get(name), "r") as fd: lines = fd.readlines() fd.close() for lin in lines: diff --git a/src/jenkinsfile/openeuler_jenkins_test.py b/src/jenkinsfile/openeuler_jenkins_test.py index eea7e8c..0546adc 100644 --- a/src/jenkinsfile/openeuler_jenkins_test.py +++ b/src/jenkinsfile/openeuler_jenkins_test.py @@ -31,7 +31,8 @@ if __name__ == '__main__': # mock所有logger为测试使用logger,输出为该文件同目录下的test.log wordk_dir = os.getcwd() _ = not os.path.exists("log") and os.mkdir("log") - logger_conf_path = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../conf/logger.conf")) + logger_conf_path = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), + "../conf/logger.conf")) logging.config.fileConfig(logger_conf_path) logger = logging.getLogger("test_logger") diff --git a/src/jobs/repo_mapping.py b/src/jobs/repo_mapping.py index c796114..7030b36 100755 --- a/src/jobs/repo_mapping.py +++ b/src/jobs/repo_mapping.py @@ -153,7 +153,6 @@ class SOERepoMapping(RepoMapping): if "__main__" == __name__: args = argparse.ArgumentParser() args.add_argument("-f", type=str, dest="community", default="src-openeuler", help="src-openeuler or openeuler") - #args.add_argument("-j", type=str, dest="jobs", help="jobs name, split by dot") args.add_argument("-j", type=str, dest="jobs", nargs="+", help="jobs name") args.add_argument("-e", type=str, dest="exclude_jobs", nargs="*", help="exclude jobs name") args.add_argument("-o", type=str, dest="mapping_file", help="output file to save buddy info") diff --git a/src/logger.py b/src/logger.py index 8e70244..b5dc185 100644 --- a/src/logger.py +++ b/src/logger.py @@ -28,7 +28,7 @@ def singleton(cls): def _singleton(*args, **kwargs): if cls not in instances: instances[cls] = cls(*args, **kwargs) - return instances[cls] + return instances.get(cls) return _singleton diff --git a/src/proxy/git_proxy.py b/src/proxy/git_proxy.py index d0b0dd8..315c59d 100644 --- a/src/proxy/git_proxy.py +++ b/src/proxy/git_proxy.py @@ -137,7 +137,6 @@ class GitProxy(object): ret, _, _ = shell_cmd_live(apply_patch_cmd) if ret: - #logger.error("apply patch failed, %s", ret) return False return True @@ -151,12 +150,10 @@ class GitProxy(object): :param leading: Remove <n> leading path components :return: boolean """ - #apply_patch_cmd = "cd {}; patch -l -t -p{} < {}".format(patch_dir, leading, patch_path) apply_patch_cmd = "cd {}; git apply --ignore-whitespace -p{} {}".format(patch_dir, leading, patch_path) ret, _, _ = shell_cmd_live(apply_patch_cmd) if ret: - #logger.error("apply patch failed, %s", ret) return False return True diff --git a/src/proxy/requests_proxy.py b/src/proxy/requests_proxy.py index 8a2d554..3ccaa1e 100644 --- a/src/proxy/requests_proxy.py +++ b/src/proxy/requests_proxy.py @@ -65,7 +65,6 @@ def do_requests(method, url, querystring=None, body=None, auth=None, timeout=30, if rs.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.no_content]: return 1 - # return response if obj is not None: if isinstance(obj, list): obj.extend(rs.json()) diff --git a/src/tools/obs_package_build_report.py b/src/tools/obs_package_build_report.py index 70e5471..98a9f2c 100644 --- a/src/tools/obs_package_build_report.py +++ b/src/tools/obs_package_build_report.py @@ -87,8 +87,8 @@ class ObsPackageBuildReport(object): """ print("{:<25}{:<25}{:<15}{:<20}{:<20}".format("project", "package", "state", "gitee", "charger")) for package in self._package_last_committer: - committer = self._package_last_committer[package]["committer"] - real_name = self._package_last_committer[package]["real_name"].encode("utf-8") + committer = self._package_last_committer.get(package).get("committer") + real_name = self._package_last_committer.get(package).get("real_name").encode("utf-8") print("{:<25}{:<25}{:<15}{:<20}{:<20}".format(self._project, package, self._state, committer, real_name)) diff --git a/src/utils/check_abi.py b/src/utils/check_abi.py index ef8b934..4e00edf 100755 --- a/src/utils/check_abi.py +++ b/src/utils/check_abi.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -#****************************************************************************** +# ****************************************************************************** # Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved. # [openeuler-jenkins] is licensed under the Mulan PSL v2. # You can use this software according to the terms and conditions of the Mulan PSL v2. @@ -36,6 +36,7 @@ import shutil import tempfile import re + class CheckAbi(object): """check abi functions""" @@ -49,7 +50,7 @@ class CheckAbi(object): self.target_sos = set() self.changed_sos = set() self.diff_result_file = "" - + def list_so_files(self, path, add_global): """ Generate a list of all .so files in the directory. @@ -235,7 +236,7 @@ class CheckAbi(object): for line in lines: if func_name in re.split(r'[(<:\s]', line): rpm_require_functions.add(func_name) - + def check_rpm_require_taget_functions(self, rpm_package, temp_path, rpm_require_functions, diff_functions): """ Check whether the rpm package calls target functions @@ -318,7 +319,6 @@ class CheckAbi(object): logging.error("the rpm_package not exists:%s", rpm_package) return False - #logging.debug("\n---check if the rpm require target .so files:%s---", rpm_package) require_info_file = os.path.join(temp_path, "require_info_file.txt") subprocess.run("rpm -qpR {} > {}".format(rpm_package, require_info_file), shell=True, stderr=subprocess.PIPE) logging.debug("write require .sos info at:%s", require_info_file) @@ -342,7 +342,7 @@ class CheckAbi(object): return True logging.debug("this rpm not require target .so files") return False - + def validate_sos(self, sos, debuginfo_path): """ Validate the command arguments @@ -401,7 +401,7 @@ class CheckAbi(object): count = count + 1 logging.info("[%d/%d] check effect rpms: %s", count, rpm_number, os.path.basename(rpm_package)) if self.check_rpm_require_taget_functions(rpm_package, temp_path, - rpm_require_functions, diff_functions): + rpm_require_functions, diff_functions): write_name = os.path.basename(rpm_package) + ":" for func in rpm_require_functions: write_name += (" " + func) @@ -438,7 +438,7 @@ class CheckAbi(object): logging.debug("find new rpms:%s", file_name) return os.path.join(rpms_dir, file_name) return None - + def find_debug_rpm(self, rpm_name, rpms_dir): """ Find debuginfo rpm by rpm name @@ -464,7 +464,7 @@ class CheckAbi(object): ofile.write(line) ofile.write("\n") ofile.close() - + def merge_all_result(self, base_name): """ Merge all result files to a .md file @@ -496,7 +496,7 @@ class CheckAbi(object): count += 1 logging.info("[%d/%d] downloading %s", count, need_download, os.path.basename(url)) subprocess.run("wget {} -P {} {} > /dev/null 2>&1".format(use_args, dest, url), - shell=True) + shell=True) return dest def process_effect_rpms(self, abs_dir, base_name): @@ -565,8 +565,6 @@ class CheckAbi(object): os.chdir(temp_path) logging.debug("\n----begin abidiff working in path:%s----", os.getcwd()) - #so_paths = [os.path.join(x, "usr/lib64") for x in abi_paths] - all_so_pairs = self.find_all_so_file(abi_paths[0], abi_paths[1]) if not all_so_pairs: os.chdir(abs_dir) @@ -575,7 +573,7 @@ class CheckAbi(object): debuginfo_paths = [os.path.join(x, "usr/lib/debug") for x in abi_paths] - rpm_base_name = os.path.basename(rpm_path[0]).rsplit("-", 2)[0] + rpm_base_name = os.path.basename(rpm_path[0]).rsplit("-", 2)[0] returncode = self.do_abidiff(all_so_pairs, rpm_base_name, debuginfo_paths) logging.debug("\n--- delete temp directory:%s ---", temp_path) @@ -615,7 +613,7 @@ class CheckAbi(object): logging.debug("rpms:%s\ndebug_rpms:%s", rpms_pair, debuginfo_rpm) return_code |= self.process_with_rpm(rpms_pair, debuginfo_rpm) return return_code - + def process_with_so(self, sos, debuginfo_path=None): """ Process the file with type of .so. @@ -648,17 +646,17 @@ def parse_command_line(): parser.add_argument("-d", "--work_path", default="/var/tmp", nargs="?", help="The work path to put rpm2cpio files and results" - " (e.g. /home/tmp_abidiff default: /var/tmp/)") + " (e.g. /home/tmp_abidiff default: /var/tmp/)") parser.add_argument("-o", "--result_output_file", default="", nargs="?", help="The result file" - " (e.g. /home/result.md)") + " (e.g. /home/result.md)") parser.add_argument("-a", "--show_all_info", action="store_true", default=False, help="show all infos includ changes in member name") parser.add_argument("-v", "--verbose", action="store_true", default=False, help="Show additional information") parser.add_argument("-i", "--input_rpms_path", default="", nargs="?", help="Find the rpm packages in this path or this list of url that calls this change interfaces" - " (e.g. /home/rpms)") + " (e.g. /home/rpms)") subparser = parser.add_subparsers(dest='command_name', help="Compare between two RPMs or two .so files or two RPMs paths") @@ -671,7 +669,7 @@ def parse_command_line(): metavar=('old_debuginfo_rpm', 'new_debuginfo_rpm'), required=False, help="Path or URL of both the old and new debuginfo RPMs," - "corresponding to compared RPMs.") + "corresponding to compared RPMs.") rpm_parser.set_defaults(func=process_with_rpm) so_parser = subparser.add_parser('compare_so', help="Compare between two .so files") @@ -681,13 +679,13 @@ def parse_command_line(): so_parser.add_argument("-f", "--debuginfo_path", nargs=2, required=False, metavar=('old_debuginfo_path', 'new_debuginfo_path'), help="Path or URL of both the old and new debuginfo files," - "corresponding to compared .so files.") + "corresponding to compared .so files.") so_parser.set_defaults(func=process_with_so) rpms_parser = subparser.add_parser('compare_rpms', help="Compare between two RPMs paths") rpms_parser.add_argument("-p", "--paths", required=True, nargs=2, - metavar=('old_path', 'new_path'), - help="Path of both the old RPMs and new RPMs") + metavar=('old_path', 'new_path'), + help="Path of both the old RPMs and new RPMs") rpms_parser.set_defaults(func=process_with_rpms) config = parser.parse_args() @@ -729,7 +727,7 @@ def main(): logging.basicConfig(format='%(message)s', level=logging.INFO) config.work_path = os.path.abspath(config.work_path) check_abi_process = CheckAbi(config.work_path, config.result_output_file, config.show_all_info, - config.verbose, config.input_rpms_path) + config.verbose, config.input_rpms_path) ret = config.func(config, check_abi_process) sys.exit(ret) diff --git a/src/utils/check_conf.py b/src/utils/check_conf.py index 9c0ee2c..c8e9139 100755 --- a/src/utils/check_conf.py +++ b/src/utils/check_conf.py @@ -74,12 +74,12 @@ class CheckConfig(object): del_configs = "" for key in new_dict.keys(): # 修改的内容 if old_dict.get(key) is not None: - if old_dict[key] != new_dict[key]: + if old_dict.get(key) != new_dict.get(key): changed_configs = changed_configs + "Key:" + key + " Old_value:" +\ - old_dict[key] + " New_value:" + new_dict[key] + "\n" + old_dict.get(key) + " New_value:" + new_dict.get(key) + "\n" old_dict.pop(key) else: - add_configs = add_configs + "Key:" + key + " Value:" + new_dict[key] + "\n" + add_configs = add_configs + "Key:" + key + " Value:" + new_dict.get(key) + "\n" if len(changed_configs): self._changed_configs[name] = changed_configs logging.debug("\n---changed_configs:%s----", self._changed_configs) diff --git a/test/ac/acl/license/test_check_license.py b/test/ac/acl/license/test_check_license.py index 31df277..a6cf79d 100644 --- a/test/ac/acl/license/test_check_license.py +++ b/test/ac/acl/license/test_check_license.py @@ -59,9 +59,9 @@ class TestCheckPkgLicense(unittest.TestCase): def _test_check_license_in_spec(self, dir_key, predict): os.chdir(os.path.join(self.DIR_PATH, - self.TEST_SAMPLE_DIR[dir_key])) + self.TEST_SAMPLE_DIR.get(dir_key))) cl = CheckLicense(self.DIR_PATH, - self.TEST_SAMPLE_DIR[dir_key]) + self.TEST_SAMPLE_DIR.get(dir_key)) self.bind_func(cl) cl.load_license_config() self.assertEqual(cl.check_license_in_spec(), predict) @@ -77,9 +77,9 @@ class TestCheckPkgLicense(unittest.TestCase): def _test_check_license_in_src(self, dir_key, predict): os.chdir(os.path.join(self.DIR_PATH, - self.TEST_SAMPLE_DIR[dir_key])) + self.TEST_SAMPLE_DIR.get(dir_key))) cl = CheckLicense(self.DIR_PATH, - self.TEST_SAMPLE_DIR[dir_key]) + self.TEST_SAMPLE_DIR.get(dir_key)) self.bind_func(cl) _ = not os.path.exists(cl.get_work_tar_dir()) and os.mkdir(cl.get_work_tar_dir()) try: @@ -101,9 +101,9 @@ class TestCheckPkgLicense(unittest.TestCase): def _test_check_license_same(self, dir_key, predict): os.chdir(os.path.join(self.DIR_PATH, - self.TEST_SAMPLE_DIR[dir_key])) + self.TEST_SAMPLE_DIR.get(dir_key))) cl = CheckLicense(self.DIR_PATH, - self.TEST_SAMPLE_DIR[dir_key]) + self.TEST_SAMPLE_DIR.get(dir_key)) self.bind_func(cl) _ = not os.path.exists(cl.get_work_tar_dir()) and os.mkdir(cl.get_work_tar_dir()) try: @@ -124,13 +124,15 @@ class TestCheckPkgLicense(unittest.TestCase): def test_check_license_same_later_version(self): cl = PkgLicense() cl.load_config() - self.assertEqual(cl.check_licenses_is_same(["GPL-1.0-or-later"], ["GPL-3.0-only"], cl._later_support_license), True) + self.assertEqual(cl.check_licenses_is_same(["GPL-1.0-or-later"], ["GPL-3.0-only"], + cl._later_support_license), True) if __name__ == "__main__": work_dir = os.getcwd() _ = not os.path.exists("log") and os.mkdir("log") - logger_conf_path = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../../src/conf/logger.conf")) + logger_conf_path = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), + "../../../../src/conf/logger.conf")) logging.config.fileConfig(logger_conf_path) logger = logging.getLogger("test_logger") # Test Package License diff --git a/test/ac/acl/package_yaml/test_check_repo.py b/test/ac/acl/package_yaml/test_check_repo.py index b65bff2..2ed9e6b 100644 --- a/test/ac/acl/package_yaml/test_check_repo.py +++ b/test/ac/acl/package_yaml/test_check_repo.py @@ -31,24 +31,31 @@ logging.getLogger('test_logger') ACCESS2INTERNET = False + class TestGetReleaseTags(unittest.TestCase): TEST_YAML_DIR = { "hg": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/hg_test/hg_test.yaml"), - "github": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/github_test/github_test.yaml"), + "github": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/github_test/github_test.yaml"), "git": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/git_test/git_test.yaml"), - "gitlab.gnome": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/gitlab_gnome_test/gitlab_gnome_test.yaml"), + "gitlab.gnome": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/gitlab_gnome_test/gitlab_gnome_test.yaml"), "svn": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/svn_test/svn_test.yaml"), - "metacpan": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/metacpan_test/metacpan_test.yaml"), + "metacpan": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/metacpan_test/metacpan_test.yaml"), "pypi": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/pypi_test/pypi_test.yaml"), - "rubygem": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/rubygem_test/rubygem_test.yaml"), - "gitee": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/gitee_test/gitee_test.yaml"), - "gnu-ftp": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/gnu_ftp_test/gnu_ftp_test.yaml") + "rubygem": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/rubygem_test/rubygem_test.yaml"), + "gitee": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/gitee_test/gitee_test.yaml"), + "gnu-ftp": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/gnu_ftp_test/gnu_ftp_test.yaml") } def _load_yaml(self, filepath): result = {} try: - with open(filepath, 'r') as yaml_data: # load yaml data + with open(filepath, 'r') as yaml_data: # load yaml data result = yaml.safe_load(yaml_data) except IOError as e: logging.warning("package yaml not exist. %s", str(e)) @@ -59,7 +66,7 @@ class TestGetReleaseTags(unittest.TestCase): def _get_test_tags(self, version): sleep(2) - yaml_content = self._load_yaml(self.TEST_YAML_DIR[version]) + yaml_content = self._load_yaml(self.TEST_YAML_DIR.get(version)) vc = yaml_content.get("version_control", "") sr = yaml_content.get("src_repo", "") release_tags = ReleaseTagsFactory.get_release_tags(vc) @@ -70,11 +77,6 @@ class TestGetReleaseTags(unittest.TestCase): release_tags = self._get_test_tags("hg") self.assertEqual(len(release_tags) > 0, True) - # 当前测试用例中网址无法访问,待后续更新,暂时关闭该单测 - # def test_get_github_release_tags(self): - # release_tags = self._get_test_tags("github") - # self.assertEqual(len(release_tags) > 0, True) - @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") def test_get_git_release_tags(self): release_tags = self._get_test_tags("git") @@ -90,11 +92,6 @@ class TestGetReleaseTags(unittest.TestCase): release_tags = self._get_test_tags("svn") self.assertEqual(len(release_tags) > 0, True) - # 当前测试用例中网址无法访问,待后续更新,暂时关闭该单测 - # def test_get_metacpan_release_tags(self): - # release_tags = self._get_test_tags("metacpan") - # self.assertEqual(len(release_tags) > 0, True) - @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") def test_get_pypi_release_tags(self): release_tags = self._get_test_tags("pypi") @@ -110,15 +107,12 @@ class TestGetReleaseTags(unittest.TestCase): release_tags = self._get_test_tags("gitee") self.assertEqual(len(release_tags) > 0, True) - # 当前测试用例中网址无法访问,待后续更新,暂时关闭该单测 - # def test_get_gnu_ftp_release_tags(self): - # release_tags = self._get_test_tags("gnu-ftp") - # self.assertEqual(len(release_tags) > 0, True) if __name__ == '__main__': work_dir = os.getcwd() _ = not os.path.exists("log") and os.mkdir("log") - logger_conf_path = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../../src/conf/logger.conf")) + logger_conf_path = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), + "../../../../src/conf/logger.conf")) logging.config.fileConfig(logger_conf_path) logger = logging.getLogger("test_logger") # Test get release tags @@ -126,6 +120,3 @@ if __name__ == '__main__': unittest.TextTestRunner().run(suite) os.chdir(work_dir) shutil.rmtree("log") - - - diff --git a/test/ac/acl/package_yaml/test_check_yaml.py b/test/ac/acl/package_yaml/test_check_yaml.py index ce3a19c..06404e5 100644 --- a/test/ac/acl/package_yaml/test_check_yaml.py +++ b/test/ac/acl/package_yaml/test_check_yaml.py @@ -31,16 +31,16 @@ from src.ac.common.gitee_repo import GiteeRepo from src.ac.acl.package_yaml.check_yaml import CheckPackageYaml from src.ac.framework.ac_result import FAILED, WARNING, SUCCESS from src.ac.acl.package_yaml.check_repo import HgReleaseTags, GithubReleaseTags, GitReleaseTags, \ - GitlabReleaseTags, SvnReleaseTags, MetacpanReleaseTags, \ - PypiReleaseTags, RubygemReleaseTags, GiteeReleaseTags, \ - GnuftpReleaseTags + GitlabReleaseTags, SvnReleaseTags, MetacpanReleaseTags, \ + PypiReleaseTags, RubygemReleaseTags, GiteeReleaseTags, \ + GnuftpReleaseTags logging.getLogger('test_logger') ACCESS2INTERNET = False -class TestCheckYamlField(unittest.TestCase): +class TestCheckYamlField(unittest.TestCase): TEST_YAML_DIR = { "missing": os.path.join(os.path.dirname(os.path.realpath(__file__)), "fields_test_sample/missing.yaml"), "standard": os.path.join(os.path.dirname(os.path.realpath(__file__)), "fields_test_sample/standard.yaml") @@ -48,64 +48,80 @@ class TestCheckYamlField(unittest.TestCase): def setUp(self): self.cy = CheckPackageYaml("", "", "") + def set_yaml(self, file): self._gr.yaml_file = file + self.cy.set_yaml = types.MethodType(set_yaml, self.cy) def test_none_file(self): self.cy.set_yaml(None) result = self.cy.check_fields() self.assertEqual(result, WARNING) - + def test_missing_fields(self): - self.cy.set_yaml(self.TEST_YAML_DIR["missing"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("missing")) result = self.cy.check_fields() self.assertEqual(result, WARNING) def test_standard_fields(self): - self.cy.set_yaml(self.TEST_YAML_DIR["standard"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("standard")) result = self.cy.check_fields() self.assertEqual(result, SUCCESS) class TestCheckYamlRepo(unittest.TestCase): - SUCCESS_TAG_LIST = ["0.0.0", "0.0.1"] FAILED_TAG_LIST = [] TEST_YAML_DIR = { "na": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/na_test/na.yaml"), "hg": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/hg_test/hg_test.yaml"), - "github": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/github_test/github_test.yaml"), + "github": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/github_test/github_test.yaml"), "git": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/git_test/git_test.yaml"), - "gitlab.gnome": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/gitlab_gnome_test/gitlab_gnome_test.yaml"), + "gitlab.gnome": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/gitlab_gnome_test/gitlab_gnome_test.yaml"), "svn": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/svn_test/svn_test.yaml"), - "metacpan": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/metacpan_test/metacpan_test.yaml"), + "metacpan": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/metacpan_test/metacpan_test.yaml"), "pypi": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/pypi_test/pypi_test.yaml"), - "rubygem": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/rubygem_test/rubygem_test.yaml"), - "gitee": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/gitee_test/gitee_test.yaml"), - "gnu-ftp": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/gnu_ftp_test/gnu_ftp_test.yaml") + "rubygem": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/rubygem_test/rubygem_test.yaml"), + "gitee": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/gitee_test/gitee_test.yaml"), + "gnu-ftp": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/gnu_ftp_test/gnu_ftp_test.yaml") } TEST_SPEC_DIR = { "na": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/na_test/na.spec"), "hg": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/hg_test/hg_test.spec"), - "github": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/github_test/github_test.spec"), + "github": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/github_test/github_test.spec"), "git": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/git_test/git_test.spec"), - "gitlab.gnome": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/gitlab_gnome_test/gitlab_gnome_test.spec"), + "gitlab.gnome": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/gitlab_gnome_test/gitlab_gnome_test.spec"), "svn": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/svn_test/svn_test.spec"), - "metacpan": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/metacpan_test/metacpan_test.spec"), + "metacpan": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/metacpan_test/metacpan_test.spec"), "pypi": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/pypi_test/pypi_test.spec"), - "rubygem": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/rubygem_test/rubygem_test.spec"), - "gitee": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/gitee_test/gitee_test.spec"), - "gnu-ftp": os.path.join(os.path.dirname(os.path.realpath(__file__)), "repo_test_sample/gnu_ftp_test/gnu_ftp_test.spec") + "rubygem": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/rubygem_test/rubygem_test.spec"), + "gitee": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/gitee_test/gitee_test.spec"), + "gnu-ftp": os.path.join(os.path.dirname(os.path.realpath(__file__)), + "repo_test_sample/gnu_ftp_test/gnu_ftp_test.spec") } def setUp(self): self.cy = CheckPackageYaml("", "", "") + def set_yaml(self, file): self._gr.yaml_file = file + def set_spec(self, file): self._spec = RPMSpecAdapter(file) + self.cy.set_yaml = types.MethodType(set_yaml, self.cy) self.cy.set_spec = types.MethodType(set_spec, self.cy) @@ -115,18 +131,18 @@ class TestCheckYamlRepo(unittest.TestCase): self.cy.check_fields() result = self.cy.check_repo() self.assertEqual(result, SUCCESS) - + @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") def test_NA_repo(self): - self.cy.set_yaml(self.TEST_YAML_DIR["na"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("na")) self.cy.check_fields() result = self.cy.check_repo() self.assertEqual(result, WARNING) - + @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(HgReleaseTags, "get_tags") def test_hg_repo_success(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["hg"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("hg")) mock_get_tags.return_value = self.SUCCESS_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -135,7 +151,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(HgReleaseTags, "get_tags") def test_hg_repo_failed(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["hg"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("hg")) mock_get_tags.return_value = self.FAILED_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -144,7 +160,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(GithubReleaseTags, "get_tags") def test_github_repo_success(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["github"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("github")) mock_get_tags.return_value = self.SUCCESS_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -153,7 +169,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(GithubReleaseTags, "get_tags") def test_github_repo_failed(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["github"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("github")) mock_get_tags.return_value = self.FAILED_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -162,7 +178,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(GitReleaseTags, "get_tags") def test_git_repo_success(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["git"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("git")) mock_get_tags.return_value = self.SUCCESS_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -171,7 +187,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(GitReleaseTags, "get_tags") def test_git_repo_failed(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["git"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("git")) mock_get_tags.return_value = self.FAILED_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -180,7 +196,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(GitlabReleaseTags, "get_tags") def test_gitlab_gnome_repo_success(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["gitlab.gnome"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("gitlab.gnome")) mock_get_tags.return_value = self.SUCCESS_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -189,7 +205,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(GitlabReleaseTags, "get_tags") def test_gitlab_gnome_repo_failed(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["gitlab.gnome"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("gitlab.gnome")) mock_get_tags.return_value = self.FAILED_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -198,7 +214,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(SvnReleaseTags, "get_tags") def test_svn_repo_success(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["svn"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("svn")) mock_get_tags.return_value = self.SUCCESS_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -207,7 +223,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(SvnReleaseTags, "get_tags") def test_svn_repo_failed(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["svn"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("svn")) mock_get_tags.return_value = self.FAILED_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -216,7 +232,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(MetacpanReleaseTags, "get_tags") def test_metacpan_repoo_success(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["metacpan"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("metacpan")) mock_get_tags.return_value = self.SUCCESS_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -225,7 +241,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(MetacpanReleaseTags, "get_tags") def test_metacpan_repo_failed(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["metacpan"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("metacpan")) mock_get_tags.return_value = self.FAILED_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -234,7 +250,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(PypiReleaseTags, "get_tags") def test_pypi_repo_success(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["pypi"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("pypi")) mock_get_tags.return_value = self.SUCCESS_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -243,7 +259,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(PypiReleaseTags, "get_tags") def test_pypi_repo_failed(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["pypi"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("pypi")) mock_get_tags.return_value = self.FAILED_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -252,7 +268,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(RubygemReleaseTags, "get_tags") def test_rubygem_repo_success(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["rubygem"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("rubygem")) mock_get_tags.return_value = self.SUCCESS_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -261,7 +277,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(RubygemReleaseTags, "get_tags") def test_rubygem_repo_failed(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["rubygem"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("rubygem")) mock_get_tags.return_value = self.FAILED_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -270,7 +286,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(GiteeReleaseTags, "get_tags") def test_gitee_repo_success(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["gitee"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("gitee")) mock_get_tags.return_value = self.SUCCESS_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -279,7 +295,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(GiteeReleaseTags, "get_tags") def test_gitee_repo_failed(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["gitee"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("gitee")) mock_get_tags.return_value = self.FAILED_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -288,7 +304,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(GnuftpReleaseTags, "get_tags") def test_gnu_ftp_repo_success(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["gnu-ftp"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("gnu-ftp")) mock_get_tags.return_value = self.SUCCESS_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -297,7 +313,7 @@ class TestCheckYamlRepo(unittest.TestCase): @unittest.skipIf((not ACCESS2INTERNET), "skip testcase need to access internet") @mock.patch.object(GnuftpReleaseTags, "get_tags") def test_gnu_ftp_repo_failed(self, mock_get_tags): - self.cy.set_yaml(self.TEST_YAML_DIR["gnu-ftp"]) + self.cy.set_yaml(self.TEST_YAML_DIR.get("gnu-ftp")) mock_get_tags.return_value = self.FAILED_TAG_LIST self.cy.check_fields() result = self.cy.check_repo() @@ -323,8 +339,8 @@ class TestCheckConsistency(unittest.TestCase): } def _test_repo_domain(self, dir_key, predict): - self.cy = CheckPackageYaml(TestCheckConsistency.DIR_PATH, - TestCheckConsistency.TEST_SAMPLE_DIR[dir_key], + self.cy = CheckPackageYaml(TestCheckConsistency.DIR_PATH, + TestCheckConsistency.TEST_SAMPLE_DIR.get(dir_key), None) self.cy.check_fields() result = self.cy.check_repo_domain() @@ -343,8 +359,8 @@ class TestCheckConsistency(unittest.TestCase): self._test_repo_domain("pypi", SUCCESS) def _test_repo_name(self, dir_key, predict): - self.cy = CheckPackageYaml(TestCheckConsistency.DIR_PATH, - TestCheckConsistency.TEST_SAMPLE_DIR[dir_key], + self.cy = CheckPackageYaml(TestCheckConsistency.DIR_PATH, + TestCheckConsistency.TEST_SAMPLE_DIR.get(dir_key), None) self.cy.check_fields() result = self.cy.check_repo_name() @@ -359,9 +375,11 @@ class TestCheckConsistency(unittest.TestCase): def test_svn_repo_name(self): self._test_repo_name("svn", SUCCESS) + if __name__ == '__main__': _ = not os.path.exists("log") and os.mkdir("log") - logger_conf_path = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../../src/conf/logger.conf")) + logger_conf_path = os.path.realpath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../../src/conf/logger.conf")) logging.config.fileConfig(logger_conf_path) logger = logging.getLogger("test_logger") # Test check yaml fields @@ -373,4 +391,4 @@ if __name__ == '__main__': # Test check repo name and repo domain suite = unittest.makeSuite(TestCheckConsistency) unittest.TextTestRunner().run(suite) - shutil.rmtree("log") \ No newline at end of file + shutil.rmtree("log") -- Gitee