Skip to content

Commit

Permalink
fix: API usage of loader
Browse files Browse the repository at this point in the history
  • Loading branch information
nichmor committed Apr 25, 2024
1 parent d10ac12 commit 06d5a07
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ pytest = "*"
syrupy = "*"
ruff = "*"

[feature.test.tasks]
test = "pytest"


[environments]
test = ["test"]
4 changes: 3 additions & 1 deletion src/rattler_build_conda_compat/loader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from contextlib import contextmanager
from os import PathLike
from pathlib import Path
import yaml
from typing import Any, Union

Expand Down Expand Up @@ -67,7 +69,7 @@ def construct_sequence(self, node: Any, deep: bool = False) -> Any:


def load_yaml(content: Union[str, bytes]):
return yaml.load(content, Loader=RecipeLoader)
return yaml.load(content, Loader=yaml.BaseLoader)


def remove_empty_keys(variant_dict):
Expand Down
8 changes: 5 additions & 3 deletions tests/test_rattler_loader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import yaml
from rattler_build_conda_compat.loader import parse_recipe_config_file, load_all_requirements
from rattler_build_conda_compat.loader import load_yaml, parse_recipe_config_file, load_all_requirements
from pathlib import Path


Expand All @@ -12,7 +12,9 @@ def test_load_variants(snapshot, unix_namespace):


def test_load_all_requirements():
recipe_path = Path("tests/data/recipe_requirements.yaml")
recipe_content = Path("tests/data/recipe_requirements.yaml").read_text()

content = load_all_requirements(recipe_path)
recipe_content = load_yaml(recipe_content)

content = load_all_requirements(recipe_content)
print(content)

0 comments on commit 06d5a07

Please sign in to comment.