def extract_our_flavors(avail_flavors, product, version, partial_updates): if is_rc(version, partial_updates): product_key = f'{product}_rc' else: product_key = product # sanity check all_flavors = set([fl['name'] for fl in SUPPORTED_FLAVORS[product_key]]) if not set(avail_flavors).issuperset(all_flavors): description = f'Some flavors are not in actions.json: {all_flavors.difference(set(avail_flavors))}.' raise UnsupportedFlavor(description=description) return SUPPORTED_FLAVORS[product_key]
def extract_our_flavors(avail_flavors, product, version, partial_updates, product_key=None): if not product_key: product_key = product if is_rc(product_key, version, partial_updates): product_key = f"{product_key}_rc" # sanity check all_flavors = set([fl["name"] for fl in SUPPORTED_FLAVORS[product_key]]) if not set(avail_flavors).issuperset(all_flavors): description = f"Some flavors are not in actions.json: {all_flavors.difference(set(avail_flavors))}." raise UnsupportedFlavor(description=description) return SUPPORTED_FLAVORS[product_key]
def test_is_rc(version, partial_updates, result): assert is_rc(version, partial_updates) == result