def select_by_testcase(items): file_path = os.environ.get("AS_TESTPLAN_PATH") ids = [] if file_path: with open(file_path, 'r') as file: plan = json.load(file) ids = set([str(item.get("id")) for item in plan]) return filter(lambda item: ids & set(allure_label(item, LabelType.ID)) if ids else True, items)
def is_planed(item): allure_ids = allure_label(item, LabelType.ID) allure_string_ids = list(map(str, allure_ids)) for planed_item in planned_tests: planed_item_string_id = str(planed_item.get("id")) planed_item_selector = planed_item.get("selector") if (planed_item_string_id in allure_string_ids or planed_item_selector == allure_full_name(item)): return True if not is_inversion else False return False if not is_inversion else True
def select_by_testcase(items): plan = [] file_path = os.environ.get("AS_TESTPLAN_PATH") if file_path: with open(file_path, 'r') as plan_file: plan = json.load(plan_file) return filter( lambda item: any([ str(planed_item.get("id")) in [str(allure_id) for allure_id in allure_label(item, LabelType.ID)] or (planed_item.get("selector") == allure_full_name(item)) for planed_item in plan ]), items) if plan else items