Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug with test: None #3018

Merged
merged 6 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions conda_forge_tick/feedstock_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
from .migrators_types import PackageName, RequirementsTypedDict

from conda_forge_tick.lazy_json_backends import LazyJson, dumps, loads

from .utils import as_iterable, parse_meta_yaml, parse_recipe_yaml
from conda_forge_tick.utils import as_iterable, parse_meta_yaml, parse_recipe_yaml

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -154,9 +153,23 @@
requirements_dict[section].update(
list(as_iterable(req.get(section, []) or [])),
)

test: "TestTypedDict" = block.get("test", {})
beckermr marked this conversation as resolved.
Show resolved Hide resolved
requirements_dict["test"].update(test.get("requirements", []) or [])
requirements_dict["test"].update(test.get("requires", []) or [])

if "tests" in block:
for test in block.get("tests", []):

Check warning on line 162 in conda_forge_tick/feedstock_parser.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/feedstock_parser.py#L162

Added line #L162 was not covered by tests
# only script tests have requirements
if "requirements" in test:
run_reqs = test["requirements"].get("run", [])
build_reqs = test["requirements"].get("build", [])
requirements_dict["test"].update(run_reqs + build_reqs)
if "python" in test:

Check warning on line 168 in conda_forge_tick/feedstock_parser.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/feedstock_parser.py#L164-L168

Added lines #L164 - L168 were not covered by tests
# if pip_check is unset or True, we need pip
if test.get("pip_check", True):
requirements_dict["test"].add("pip")

Check warning on line 171 in conda_forge_tick/feedstock_parser.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/feedstock_parser.py#L170-L171

Added lines #L170 - L171 were not covered by tests

run_exports = (block.get("build", {}) or {}).get("run_exports", {})
if isinstance(run_exports, dict) and run_exports.get("strong"):
strong_exports = True
Expand Down Expand Up @@ -686,3 +699,23 @@
conda_forge_yaml=conda_forge_yaml,
mark_not_archived=mark_not_archived,
)


if __name__ == "__main__":
graph = {}
load_feedstock_local(

Check warning on line 706 in conda_forge_tick/feedstock_parser.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/feedstock_parser.py#L705-L706

Added lines #L705 - L706 were not covered by tests
"carma",
graph,
)

import json
import pprint

Check warning on line 712 in conda_forge_tick/feedstock_parser.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/feedstock_parser.py#L711-L712

Added lines #L711 - L712 were not covered by tests

class SetEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, set):
return list(obj)
return json.JSONEncoder.default(self, obj)

Check warning on line 718 in conda_forge_tick/feedstock_parser.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/feedstock_parser.py#L714-L718

Added lines #L714 - L718 were not covered by tests

pprint.pprint(graph)
print(json.dumps(graph, indent=4, cls=SetEncoder))

Check warning on line 721 in conda_forge_tick/feedstock_parser.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/feedstock_parser.py#L720-L721

Added lines #L720 - L721 were not covered by tests
3 changes: 1 addition & 2 deletions conda_forge_tick/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,8 @@ def _parse_recipes(
{
"name": None if package_output is None else package_output.get("name"),
"requirements": requirements_output_data,
"test": None,
"build": build_output_data,
"tests": recipe.get("tests", []),
}
)

Expand All @@ -520,7 +520,6 @@ def _parse_recipes(
"package": package_data,
"requirements": requirements_data,
"source": source_data,
"test": None,
"outputs": output_data,
"extra": first.get("extra"),
}
Expand Down