Skip to content

Commit

Permalink
Remove code for defunct CMP project
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoura committed Nov 8, 2019
1 parent c901a85 commit 52715db
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 220 deletions.
54 changes: 0 additions & 54 deletions dump2polarion/exporters/transform_projects.py
Expand Up @@ -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."""
Expand All @@ -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,
}

Expand Down
11 changes: 0 additions & 11 deletions tests/conftest.py
Expand Up @@ -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")
Expand Down
98 changes: 0 additions & 98 deletions tests/data/ostriz_cmp.json

This file was deleted.

24 changes: 0 additions & 24 deletions tests/data/ostriz_transform_cmp.xml

This file was deleted.

14 changes: 0 additions & 14 deletions tests/test_ostriztools.py
Expand Up @@ -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")
Expand Down Expand Up @@ -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()
Expand Down
19 changes: 0 additions & 19 deletions tests/test_transform.py
Expand Up @@ -104,35 +104,16 @@
),
] # 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:
@pytest.fixture(scope="class")
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]

0 comments on commit 52715db

Please sign in to comment.