From 93912a67ad6aa2ded75b29f2d6ac79f1b6594a46 Mon Sep 17 00:00:00 2001 From: beckermr Date: Sat, 1 Jun 2024 07:06:31 -0500 Subject: [PATCH] BUG fix usage of channel data --- conda_forge_feedstock_check_solvable/utils.py | 10 +++++----- tests/test_utils.py | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/conda_forge_feedstock_check_solvable/utils.py b/conda_forge_feedstock_check_solvable/utils.py index ff3d0a1..c9ec082 100644 --- a/conda_forge_feedstock_check_solvable/utils.py +++ b/conda_forge_feedstock_check_solvable/utils.py @@ -329,21 +329,21 @@ def _get_run_exports_from_run_exports_json(channel_url, subdir, filename): def _has_run_exports_in_channel_data(channel_url, filename): cd = _download_channeldata(channel_url) name_ver, _ = filename.rsplit("-", 1) - name, _ = name_ver.rsplit("-", 1) + name, ver = name_ver.rsplit("-", 1) if "packages" not in cd: return True - if "name" not in cd["packages"]: + if name not in cd["packages"]: return True if "run_exports" not in cd["packages"][name]: return True - if cd["packages"][name]["run_exports"]: - return True - else: + if ver not in cd["packages"][name]["run_exports"]: return False + else: + return True def _get_run_exports_from_artifact_info(channel, subdir, filename): diff --git a/tests/test_utils.py b/tests/test_utils.py index 3594d52..83d9443 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -6,6 +6,7 @@ _get_run_exports_from_artifact_info, _get_run_exports_from_download, _get_run_exports_from_run_exports_json, + _has_run_exports_in_channel_data, convert_spec_to_conda_build, get_run_exports, ) @@ -51,6 +52,15 @@ def test_convert_spec_to_conda_build(inreq, outreq): ], ) def test_utils_get_run_exports(full_channel_url, filename, expected): + if expected == DEFAULT_RUN_EXPORTS: + assert not _has_run_exports_in_channel_data( + full_channel_url.rsplit("/", 1)[0], filename + ) + else: + assert _has_run_exports_in_channel_data( + full_channel_url.rsplit("/", 1)[0], filename + ) + assert get_run_exports(full_channel_url, filename) == expected assert (