From f9bd1712322e30460a18ef3ba53f97b660ff2b23 Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Mon, 23 Sep 2024 10:08:24 +0200 Subject: [PATCH 1/4] enable v1 linting --- conda_forge_webservices/linting.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/conda_forge_webservices/linting.py b/conda_forge_webservices/linting.py index ca5bca0fb..c843773f0 100644 --- a/conda_forge_webservices/linting.py +++ b/conda_forge_webservices/linting.py @@ -51,18 +51,6 @@ def lint_all_recipes(all_recipe_dir: Path, base_recipes: list[Path]) -> tuple[st rel_path = recipe.relative_to(all_recipe_dir) rel_pr_recipes.append(rel_path) - if recipe.name == "recipe.yaml": - # this is a v1 recipe and not yet handled - hint = "\nFor **{}**:\n\n{}".format( - rel_path, - "This is a v1 recipe and not yet lintable. " "We are working on it!", - ) - messages.append(hint) - # also add it to hints so that the PR is marked as mixed - hints.append(hint) - hints_found = True - continue - try: lints, hints = conda_smithy.lint_recipe.main( str(recipe_dir), conda_forge=True, return_hints=True From 4a075838043380d344611ccbf593472e7f8b8cae Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Mon, 23 Sep 2024 10:26:49 +0200 Subject: [PATCH 2/4] fix tests, enable v1 lint --- .../linting/test_compute_lint_message.py | 46 +++++-------------- environment.yml | 3 +- 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/conda_forge_webservices/tests/linting/test_compute_lint_message.py b/conda_forge_webservices/tests/linting/test_compute_lint_message.py index 07d18deb1..585a07fd0 100644 --- a/conda_forge_webservices/tests/linting/test_compute_lint_message.py +++ b/conda_forge_webservices/tests/linting/test_compute_lint_message.py @@ -2,7 +2,6 @@ import textwrap from pathlib import Path -from inline_snapshot import snapshot from conda_forge_webservices.linting import compute_lint_message, lint_all_recipes @@ -146,25 +145,16 @@ def test_conflict_2_ok_recipe(): def test_v1_recipe(): - expected_message = textwrap.dedent(""" - Hi! This is the friendly automated conda-forge-linting service. - - I just wanted to let you know that I linted all conda-recipes in your PR (```recipe/recipe.yaml```) and found it was in an excellent condition. - - - I do have some suggestions for making it better though... - - - For **recipe/recipe.yaml**: - - This is a v1 recipe and not yet lintable. We are working on it! - """) # noqa - + expected = ( + "I wanted to let you know that I linted all conda-recipes in your PR " + "(```recipe/recipe.yaml```) and found some lint." + ) + lint = lint_all_recipes(data_folder(), []) lint = compute_lint_message( "conda-forge", "conda-forge-webservices", 632, set_pending_status=False ) assert lint is not None, lint["message"] - assert expected_message == lint["message"] + assert expected in lint["message"], lint["message"] def test_bad_recipe(): @@ -252,23 +242,9 @@ def test_new_recipe(tmp_path): recipe_file.parent.mkdir(parents=True) shutil.copy(data_folder() / "recipe.yaml", recipe_file) - message = lint_all_recipes(Path(tmp_path), []) - assert message == snapshot( - ( - """\ - -Hi! This is the friendly automated conda-forge-linting service. - -I just wanted to let you know that I linted all conda-recipes in your PR (```recipe/recipe.yaml```) and found it was in an excellent condition. - - -I do have some suggestions for making it better though... - - -For **recipe/recipe.yaml**: - -This is a v1 recipe and not yet lintable. We are working on it! -""", # noqa - "mixed", - ) + message, status = lint_all_recipes(Path(tmp_path), []) + assert status == "bad" + assert ( + "I wanted to let you know that I linted all conda-recipes in your PR " + "(```recipe/recipe.yaml```) and found some lint." in message ) diff --git a/environment.yml b/environment.yml index a04889adc..aa05bfa22 100644 --- a/environment.yml +++ b/environment.yml @@ -27,9 +27,8 @@ dependencies: - setuptools - setuptools_scm >=8 - shellcheck - - tini + # - tini - tornado - tqdm # dev dependencies - pytest <8.2.0 - - inline-snapshot >=0.11 From 1404979d7625605f33591bb83aefbfe8e1f7e57d Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Mon, 23 Sep 2024 10:27:42 +0200 Subject: [PATCH 3/4] revert tini --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index aa05bfa22..053c7ff32 100644 --- a/environment.yml +++ b/environment.yml @@ -27,7 +27,7 @@ dependencies: - setuptools - setuptools_scm >=8 - shellcheck - # - tini + - tini - tornado - tqdm # dev dependencies From 335873e89b91a4a15e67e500533d7e806c96289d Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 23 Sep 2024 05:09:41 -0500 Subject: [PATCH 4/4] test: update tests for new test branches --- .../tests/linting/test_compute_lint_message.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conda_forge_webservices/tests/linting/test_compute_lint_message.py b/conda_forge_webservices/tests/linting/test_compute_lint_message.py index 585a07fd0..0f722b75e 100644 --- a/conda_forge_webservices/tests/linting/test_compute_lint_message.py +++ b/conda_forge_webservices/tests/linting/test_compute_lint_message.py @@ -65,21 +65,21 @@ def test_ok_recipe_above_good_recipe(): lint = compute_lint_message( "conda-forge", "conda-forge-webservices", 54, set_pending_status=False ) - assert expected_message == lint["message"] + assert lint["message"].startswith(expected_message) def test_ok_recipe_beside_good_recipe(): expected_message = textwrap.dedent(""" Hi! This is the friendly automated conda-forge-linting service. - I just wanted to let you know that I linted all conda-recipes in your PR (```recipe/meta.yaml```, ```recipes/recipe/meta.yaml```) and found it was in an excellent condition. + I just wanted to let you know that I linted all conda-recipes in your PR (```recipe/blah/meta.yaml```, ```recipe/meta.yaml```, ```recipes/recipe/meta.yaml```) and found it was in an excellent condition. """) # noqa lint = compute_lint_message( "conda-forge", "conda-forge-webservices", 62, set_pending_status=False ) - assert expected_message == lint["message"] + assert lint["message"].startswith(expected_message) def test_ok_recipe_above_ignored_good_recipe(): @@ -93,21 +93,21 @@ def test_ok_recipe_above_ignored_good_recipe(): lint = compute_lint_message( "conda-forge", "conda-forge-webservices", 54, True, set_pending_status=False ) - assert expected_message == lint["message"] + assert lint["message"].startswith(expected_message) def test_ok_recipe_beside_ignored_good_recipe(): expected_message = textwrap.dedent(""" Hi! This is the friendly automated conda-forge-linting service. - I just wanted to let you know that I linted all conda-recipes in your PR (```recipe/meta.yaml```) and found it was in an excellent condition. + I just wanted to let you know that I linted all conda-recipes in your PR (```recipe/blah/meta.yaml```, ```recipe/meta.yaml```) and found it was in an excellent condition. """) # noqa lint = compute_lint_message( "conda-forge", "conda-forge-webservices", 62, True, set_pending_status=False ) - assert expected_message == lint["message"] + assert lint["message"].startswith(expected_message) def test_conflict_ok_recipe():