def _get_available_from_local_store(local_versions: PluginInfos, pi: PluginInfo) -> str: available_pi = local_versions.latest_version_matching_spec( # filter for name-and-variant PluginSpec(pi.name, pi.variant)) if available_pi: available_version = available_pi.formatted_version() available = ("<same>" if available_version == pi.formatted_version() else available_version) else: available = "" return available
def test_latest_version_matching_spec_none(self, plugininfo_list, spec): pis = PluginInfos(plugininfo_list) assert pis.latest_version_matching_spec(spec) is None
def test_latest_version_matching_spec(self, plugininfo_list, spec, expected_nvv): pis = PluginInfos(plugininfo_list) expected = PluginInfo.make_from_name_variant_version(*expected_nvv) assert pis.latest_version_matching_spec(spec) == expected