Skip to content

Commit

Permalink
Add more test to cover set_python_min
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelotrevisani committed Nov 13, 2024
1 parent b594304 commit 735d83f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion grayskull/strategy/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,9 @@ def set_python_min(req_list: list, section: str) -> list:
return req_list
python_min = "<{ python_min }}"
map_section = {
"test": f"={python_min}",
"host": f"{python_min}.*",
"run": f">={python_min}",
"test": f"={python_min}",
}
return [
f"python {map_section[section]}" if dep.lower().strip() == "python" else dep
Expand Down
14 changes: 14 additions & 0 deletions tests/test_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
normalize_requirements_list,
remove_all_inner_nones,
remove_selectors_pkgs_if_needed,
set_python_min,
sort_reqs,
update_recipe,
)
Expand Down Expand Up @@ -1453,3 +1454,16 @@ def test_check_noarch_python_for_new_deps():
config,
)
assert config.is_arch is False


@pytest.mark.parametrize(
"section, expected",
[
("host", "python <{ python_min }}.*"),
("run", "python >=<{ python_min }}"),
("test", "python =<{ python_min }}"),
],
)
def test_set_python_min(section, expected):
req = ["pip", "python"]
assert set_python_min(req, section) == ["pip", expected]

0 comments on commit 735d83f

Please sign in to comment.