Skip to content

Commit

Permalink
add test for detecting wrong values in os_version
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Nov 22, 2024
1 parent 93dd085 commit 1c2b6ee
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_lint_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2481,6 +2481,37 @@ def test_lint_duplicate_cfyml():
assert not any(lint.startswith(expected_message) for lint in lints)


def test_cfyml_wrong_os_version():
expected_message = (
"{'linux_64': 'wrong'} is not valid under any of the given schemas"
)

with tmp_directory() as feedstock_dir:
cfyml = os.path.join(feedstock_dir, "conda-forge.yml")
recipe_dir = os.path.join(feedstock_dir, "recipe")
os.makedirs(recipe_dir, exist_ok=True)
with open(os.path.join(recipe_dir, "meta.yaml"), "w") as fh:
fh.write(
"""
package:
name: foo
"""
)

with open(cfyml, "w") as fh:
fh.write(
textwrap.dedent(
"""
os_version:
linux_64: wrong
"""
)
)

lints = linter.main(recipe_dir, conda_forge=True)
assert any(expected_message in lint for lint in lints)


@pytest.mark.parametrize(
"yaml_block,expected_message",
[
Expand Down

0 comments on commit 1c2b6ee

Please sign in to comment.