From 52715db50f7abfba63b14f477bb52e918066d25d Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Fri, 8 Nov 2019 16:19:41 +0100 Subject: [PATCH] Remove code for defunct CMP project --- dump2polarion/exporters/transform_projects.py | 54 ---------- tests/conftest.py | 11 --- tests/data/ostriz_cmp.json | 98 ------------------- tests/data/ostriz_transform_cmp.xml | 24 ----- tests/test_ostriztools.py | 14 --- tests/test_transform.py | 19 ---- 6 files changed, 220 deletions(-) delete mode 100644 tests/data/ostriz_cmp.json delete mode 100644 tests/data/ostriz_transform_cmp.xml diff --git a/dump2polarion/exporters/transform_projects.py b/dump2polarion/exporters/transform_projects.py index 0a66c23..60ab4bf 100644 --- a/dump2polarion/exporters/transform_projects.py +++ b/dump2polarion/exporters/transform_projects.py @@ -179,59 +179,6 @@ def requirement_transform(requirement): return requirement_transform -# pylint: disable=unused-argument -def get_xunit_transform_cmp(config): - """Return result transformation function for CMP.""" - skip_searches = [ - "SKIPME:", - "Skipping due to these blockers", - "BZ ?[0-9]+", - "GH ?#?[0-9]+", - "GH#ManageIQ", - ] - skips = re.compile("(" + ")|(".join(skip_searches) + ")") - - def results_transform(result): - """Transform results for CMP.""" - verdict = result.get("verdict") - if not verdict: - return None - - result = copy.deepcopy(result) - - # don't parametrize if not specifically configured - if result.get("params"): - del result["params"] - - classname = result.get("classname", "") - if classname: - # we don't need to pass classnames? - del result["classname"] - - # if the "test_id" property is present, use it as test case ID - test_id = result.get("test_id", "") - if test_id: - result["id"] = test_id - - verdict = verdict.strip().lower() - # we want to submit PASS and WAIT results - if verdict in Verdicts.PASS + Verdicts.WAIT: - return result - comment = result.get("comment") - # ... and SKIP results where there is a good reason (blocker etc.) - if verdict in Verdicts.SKIP and comment and skips.search(comment): - # found reason for skip - result["comment"] = comment.replace("SKIPME: ", "").replace("SKIPME", "") - return result - if verdict in Verdicts.FAIL and comment and "FAILME" in comment: - result["comment"] = comment.replace("FAILME: ", "").replace("FAILME", "") - return result - # we don't want to report this result if here - return None - - return results_transform - - # pylint: disable=unused-argument def get_requirements_transform_cloudtp(config): # noqa: D202 """Return requirement transformation function for CLOUDTP.""" @@ -255,7 +202,6 @@ def requirement_transform(requirement): PROJECT_MAPPING_XUNIT = { "RHCF3": get_xunit_transform_cfme, - "CMP": get_xunit_transform_cmp, "CLOUDTP": get_xunit_transform_cfme, } diff --git a/tests/conftest.py b/tests/conftest.py index fd942c2..6546553 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -71,23 +71,12 @@ RHCF3_CONF["requirements_default_fields"] = REQUIREMENTS_DEFAULT_FIELDS RHCF3_CONF["docstrings"] = VALID_CASELEVELS -CMP_CONF = GENERIC_CONF.copy() -CMP_CONF["polarion-project-id"] = "CMP" -CMP_CONF["xunit_import_properties"] = RHCF3_XUNIT_PROPS.copy() -CMP_CONF["default_fields"] = POLARION_DEFAULT_FIELDS.copy() -CMP_CONF["docstrings"] = VALID_CASELEVELS.copy() - @pytest.fixture(scope="session") def config_prop(): return copy.deepcopy(RHCF3_CONF) -@pytest.fixture(scope="session") -def config_prop_cmp(): - return copy.deepcopy(CMP_CONF) - - @pytest.fixture(scope="function") def config_e2e(): conf_file = os.path.join(conf.DATA_PATH, "polarion_tools.yaml") diff --git a/tests/data/ostriz_cmp.json b/tests/data/ostriz_cmp.json deleted file mode 100644 index 061949c..0000000 --- a/tests/data/ostriz_cmp.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "tests": { - "cfme/tests/containers/test_tables_fields.py/test_tables_fields[ocp-v1-ImageRegistry (CMP-9985)]": { - "requirement": "None", - "run": "22", - "stream": "downstream-59z", - "test_module": "cfme/tests/containers/test_tables_fields.py", - "durations": { - "setup": 0.8646628856658936, - "call": 26.643051862716675 - }, - "test_name": "test_tables_fields[ocp-v1-ImageRegistry (CMP-9985)]", - "tier": 1, - "slaveid": null, - "statuses": { - "overall": "passed", - "setup": [ - "passed", - false - ], - "call": [ - "passed", - false - ] - }, - "start_time": 1516743120.886384, - "name": "cfme/tests/containers/test_tables_fields.py/test_tables_fields[ocp-v1-ImageRegistry (CMP-9985)]", - "polarion": [ - "CMP-9985" - ], - "finish_time": 1516743148.266379, - "source": "jenkins", - "version": "5.9.0.17", - "params": { - "browserName": "firefox", - "provider": "ocp-v1", - "browserVersion": "45.5.0", - "browserPlatform": "LINUX", - "test_item": "" - }, - "issues": [], - "jenkins": { - "build_url": "https://cfmeqe-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/downstream-59z-cmqe-juwatts-poc/22/", - "build_number": "22", - "job_name": "downstream-59z-cmqe-juwatts-poc", - "git_commit": "325707c384819521eb0d6594f7be882766eac9ba" - }, - "method": "automated", - "build": "5.9.0.17-20180116225234_ac8b6f5" - }, - "cfme/tests/containers/test_tables_fields.py/test_tables_fields[ocp-v2-Container (CMP-9943)]": { - "requirement": "None", - "run": "22", - "stream": "downstream-59z", - "test_module": "cfme/tests/containers/test_tables_fields.py", - "durations": { - "setup": 0.7888579368591309, - "call": 38.275193214416504 - }, - "test_name": "test_tables_fields[ocp-v2-Container (CMP-9943)]", - "tier": 1, - "slaveid": null, - "statuses": { - "overall": "passed", - "setup": [ - "passed", - false - ], - "call": [ - "passed", - false - ] - }, - "start_time": 1516743444.207331, - "name": "cfme/tests/containers/test_tables_fields.py/test_tables_fields[ocp-v2-Container (CMP-9943)]", - "polarion": "CMP-9943", - "finish_time": 1516743483.123513, - "source": "jenkins", - "version": "5.9.0.17", - "params": { - "browserName": "firefox", - "provider": "ocp-v2", - "browserVersion": "45.5.0", - "browserPlatform": "LINUX", - "test_item": "" - }, - "issues": [], - "jenkins": { - "build_url": "https://cfmeqe-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/downstream-59z-cmqe-juwatts-poc/22/", - "build_number": "22", - "job_name": "downstream-59z-cmqe-juwatts-poc", - "git_commit": "325707c384819521eb0d6594f7be882766eac9ba" - }, - "method": "automated", - "build": "5.9.0.17-20180116225234_ac8b6f5" - } - } -} diff --git a/tests/data/ostriz_transform_cmp.xml b/tests/data/ostriz_transform_cmp.xml deleted file mode 100644 index 10eb37c..0000000 --- a/tests/data/ostriz_transform_cmp.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_ostriztools.py b/tests/test_ostriztools.py index 8d75651..5f366dd 100644 --- a/tests/test_ostriztools.py +++ b/tests/test_ostriztools.py @@ -17,12 +17,6 @@ def records_json(): return ostriztools.import_ostriz(json_file) -@pytest.fixture(scope="module") -def records_json_cmp(): - json_file = os.path.join(conf.DATA_PATH, "ostriz_cmp.json") - return ostriztools.import_ostriz(json_file) - - @pytest.fixture(scope="module") def records_json_search(): json_file = os.path.join(conf.DATA_PATH, "ostriz_search.json") @@ -116,14 +110,6 @@ def test_e2e_ids_transform(self, config_prop, records_json): parsed = input_xml.read() assert complete == parsed - def test_e2e_cmp_ids_transform(self, config_prop_cmp, records_json_cmp): - exporter = XunitExport("5_8_0_17", records_json_cmp, config_prop_cmp) - complete = exporter.export() - fname = "ostriz_transform_cmp.xml" - with open(os.path.join(conf.DATA_PATH, fname), encoding="utf-8") as input_xml: - parsed = input_xml.read() - assert complete == parsed - def test_e2e_ids_search_transform(self, config_prop, records_json_search): exporter = XunitExport("5_8_0_17", records_json_search, config_prop) complete = exporter.export() diff --git a/tests/test_transform.py b/tests/test_transform.py index 18b7cdf..215524a 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -104,16 +104,7 @@ ), ] # type: List[Tuple] -CMP_ONLY = [ - ( - {"classname": "test_1", "title": "test_1", "verdict": "passed", "test_id": "CMP-9985"}, - {"title": "test_1", "verdict": "passed", "test_id": "CMP-9985", "id": "CMP-9985"}, - "add_id", - ) -] # type: List[Tuple] - RHCF3_DATA = RHCF3_ONLY + NOT_PASSED -CMP_DATA = CMP_ONLY + NOT_PASSED class TestTransform: @@ -121,18 +112,8 @@ class TestTransform: def config_rhcf3(self): return {"polarion-project-id": "RHCF3"} - @pytest.fixture(scope="class") - def config_cmp(self): - return {"polarion-project-id": "CMP"} - @pytest.mark.parametrize("data", RHCF3_DATA, ids=[d[2] for d in RHCF3_DATA]) def test_transform_rhcf3(self, config_rhcf3, data): tfunc = transform_projects.get_xunit_transform(config_rhcf3) result = tfunc(data[0]) assert result == data[1] - - @pytest.mark.parametrize("data", CMP_DATA, ids=[d[2] for d in CMP_DATA]) - def test_transform_cmp(self, config_cmp, data): - tfunc = transform_projects.get_xunit_transform(config_cmp) - result = tfunc(data[0]) - assert result == data[1]