From 53aacef29ca3590b139c95fa4eac78ffa590cda0 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Fri, 24 Apr 2020 10:39:44 +0800 Subject: [PATCH] code clean up --- tools/ci/python_packages/gitlab_api.py | 6 +----- .../ci/python_packages/tiny_test_fw/Utility/SearchCases.py | 1 + tools/ci/python_packages/ttfw_idf/CIAssignExampleTest.py | 2 +- tools/ci/python_packages/ttfw_idf/CIScanTests.py | 3 --- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/tools/ci/python_packages/gitlab_api.py b/tools/ci/python_packages/gitlab_api.py index 3d49dbb40..561ffb863 100644 --- a/tools/ci/python_packages/gitlab_api.py +++ b/tools/ci/python_packages/gitlab_api.py @@ -124,7 +124,7 @@ class Gitlab(object): return raw_data_list - def find_job_id(self, job_name, pipeline_id=None, job_status="success", suffix=None): + def find_job_id(self, job_name, pipeline_id=None, job_status="success"): """ Get Job ID from job name of specific pipeline @@ -132,7 +132,6 @@ class Gitlab(object): :param pipeline_id: If None, will get pipeline id from CI pre-defined variable. :param job_status: status of job. One pipeline could have multiple jobs with same name after retry. job_status is used to filter these jobs. - :param suffix: suffix of the job. e.g. 'limit' for build only needed apps. :return: a list of job IDs (parallel job will generate multiple jobs) """ job_id_list = [] @@ -145,9 +144,6 @@ class Gitlab(object): if match: if match.group(1) == job_name and job.status == job_status: job_id_list.append({"id": job.id, "parallel_num": match.group(3)}) - elif suffix: - if match.group(1) == "{}_{}".format(job_name, suffix) and job.status == job_status: - job_id_list.append({"id": job.id, "parallel_num": match.group(3)}) return job_id_list @retry_download diff --git a/tools/ci/python_packages/tiny_test_fw/Utility/SearchCases.py b/tools/ci/python_packages/tiny_test_fw/Utility/SearchCases.py index c36fec8ad..d85283b76 100644 --- a/tools/ci/python_packages/tiny_test_fw/Utility/SearchCases.py +++ b/tools/ci/python_packages/tiny_test_fw/Utility/SearchCases.py @@ -125,6 +125,7 @@ class Search(object): search all test cases from a folder or file, and then do case replicate. :param test_case: test case file(s) path + :param test_case_file_pattern: unix filename pattern :return: a list of replicated test methods """ test_case_files = cls._search_test_case_files(test_case, test_case_file_pattern or cls.TEST_CASE_FILE_PATTERN) diff --git a/tools/ci/python_packages/ttfw_idf/CIAssignExampleTest.py b/tools/ci/python_packages/ttfw_idf/CIAssignExampleTest.py index 99af101c0..3acdd78d0 100644 --- a/tools/ci/python_packages/ttfw_idf/CIAssignExampleTest.py +++ b/tools/ci/python_packages/ttfw_idf/CIAssignExampleTest.py @@ -65,7 +65,7 @@ def create_artifact_index_file(project_id=None, pipeline_id=None, case_group=Exa return "{}/list_job_{}.json".format(case_group.BUILD_LOCAL_DIR, parallel or 1) for build_job_name in case_group.BUILD_JOB_NAMES: - job_info_list = gitlab_inst.find_job_id(build_job_name, pipeline_id=pipeline_id, suffix='limit') + job_info_list = gitlab_inst.find_job_id(build_job_name, pipeline_id=pipeline_id) for job_info in job_info_list: raw_data = gitlab_inst.download_artifact(job_info["id"], [format_build_log_path()])[0] build_info_list = [json.loads(line) for line in raw_data.splitlines()] diff --git a/tools/ci/python_packages/ttfw_idf/CIScanTests.py b/tools/ci/python_packages/ttfw_idf/CIScanTests.py index c56664f6b..b087aa3e5 100644 --- a/tools/ci/python_packages/ttfw_idf/CIScanTests.py +++ b/tools/ci/python_packages/ttfw_idf/CIScanTests.py @@ -57,7 +57,6 @@ def main(): actions.add_parser('example_test', parents=[common]) actions.add_parser('test_apps', parents=[common]) - # actions.add_parser('unit_test', parents=[common]) args = parser.parse_args() @@ -68,8 +67,6 @@ def main(): elif args.action == 'test_apps': CIExampleAssignTest.CI_TEST_JOB_PATTERN = re.compile(r'^test_app_test_.+') assign = CIExampleAssignTest(path, args.ci_config_file, TestAppsGroup) - # elif args.action == 'unit_test': - # assign = UnitTestAssignTest(args.test_case, args.ci_config_file) else: raise SystemExit(1) # which is impossible