def test_merge_no_witness(self): results_xml_cp1 = copy.deepcopy(results_xml) results_xml_cp2 = copy.deepcopy(results_xml) mergeBenchmarkSets.merge(results_xml_cp2, [], True) for run in results_xml_cp1.findall("run"): del run.attrib["logfile"] self.assertEqual(ET.tostring(results_xml_cp1), ET.tostring(results_xml_cp2))
def test_merge_no_overwrite(self): expected_results = [ ("true", result.CATEGORY_CORRECT), ("false(unreach-call)", result.CATEGORY_CORRECT), ("TIMEOUT", result.CATEGORY_ERROR), ("witness invalid (false(unreach-call))", result.CATEGORY_ERROR), ("false(unreach-call)", result.CATEGORY_WRONG), ] results_xml_cp = copy.deepcopy(results_xml) mergeBenchmarkSets.merge(results_xml_cp, mock_witness_sets(), False) for expected, run in zip(expected_results, results_xml_cp.findall("run")): status = run.find('column[@title="status"]').get("value") category = run.find('column[@title="category"]').get("value") self.assertTupleEqual(expected, (status, category))
def test_merge_no_status_no_category(self): expected_results = [("not found", result.CATEGORY_CORRECT)] * 5 modified_results = copy.deepcopy(results_xml) for run in modified_results.findall("run"): status_column = run.find('column[@title="status"]') category_column = run.find('column[@title="category"]') run.remove(status_column) run.remove(category_column) run.set("properties", "coverage-branches") mergeBenchmarkSets.merge(modified_results, mock_witness_sets(), True) for expected, run in zip(expected_results, modified_results.findall("run")): status = run.find('column[@title="status"]').get("value") category = run.find('column[@title="category"]').get("value") self.assertTupleEqual(expected, (status, category))