Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Aug 9, 2024
1 parent c1e637d commit e23194f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions conda_smithy/lint_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def lintify_forge_yaml(recipe_dir: str | None = None) -> (list, list):

def lintify_meta_yaml(
meta: Any,
recipe_dir : str | None = None,
conda_forge : bool = False,
recipe_dir: str | None = None,
conda_forge: bool = False,
recipe_version: int = 0,
) -> Tuple[List[str], List[str]]:
lints = []
Expand Down
14 changes: 5 additions & 9 deletions tests/test_lint_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ def test_recipe_v1_test_section(self):
self.assertIn(expected_message, lints)

lints, hints = linter.lintify_meta_yaml(
{"tests": {"script": "sys"}}, recipe_version=1
{"tests": [{"script": "sys"}]}, recipe_version=1
)
self.assertNotIn(expected_message, lints)

Expand Down Expand Up @@ -774,12 +774,13 @@ def test_recipe_v1_test_section_with_recipe(self):
)
self.assertIn(expected_message, lints)

# Note: v1 recipes don't have implicit "run_test.py" support
with open(os.path.join(recipe_dir, "run_test.py"), "w") as fh:
fh.write("# foo")
lints, hints = linter.lintify_meta_yaml(
{}, recipe_dir, recipe_version=1
)
self.assertNotIn(expected_message, lints)
self.assertIn(expected_message, lints)

def test_jinja2_vars(self):
expected_message = (
Expand Down Expand Up @@ -2676,23 +2677,18 @@ def test_pin_compatible_in_run_exports_output(recipe_version: int):


def test_v1_recipes():
with get_recipe_in_dir(
"v1_recipes/recipe-no-lint.yaml"
) as recipe_dir:
with get_recipe_in_dir("v1_recipes/recipe-no-lint.yaml") as recipe_dir:
lints, hints = linter.main(str(recipe_dir), return_hints=True)
assert not lints


def test_v1_no_test():
with get_recipe_in_dir(
"v1_recipes/recipe-no-tests.yaml"
) as recipe_dir:
with get_recipe_in_dir("v1_recipes/recipe-no-tests.yaml") as recipe_dir:
lints, hints = linter.main(str(recipe_dir), return_hints=True)
print(lints)
assert "The recipe must have some tests." in lints



def test_v1_package_name_version():
with get_recipe_in_dir(
"v1_recipes/recipe-lint-name-version.yaml"
Expand Down

0 comments on commit e23194f

Please sign in to comment.