diff --git a/conda_smithy/linter/hints.py b/conda_smithy/linter/hints.py index a2c217904..d2f45a721 100644 --- a/conda_smithy/linter/hints.py +++ b/conda_smithy/linter/hints.py @@ -254,12 +254,13 @@ def hint_noarch_python_use_python_min( syntax = syntax.replace( "{{ python_min }}", "${{ python_min }}" ) + test_syntax = syntax.replace("{{ python_min }}", "9999") for req in reqs: if ( req.strip().split()[0] == "python" and req != "python" - and syntax in req + and test_syntax in req ): break else: diff --git a/conda_smithy/utils.py b/conda_smithy/utils.py index 4d94461c5..c4f58369b 100644 --- a/conda_smithy/utils.py +++ b/conda_smithy/utils.py @@ -140,6 +140,7 @@ def render_meta_yaml(text): target_platform="linux-64", build_platform="linux-64", mpi="mpi", + python_min="9999", # use as a sentinel value for linting ) ) mockos = MockOS() diff --git a/tests/test_lint_recipe.py b/tests/test_lint_recipe.py index 178c7ab6e..42c009f3b 100644 --- a/tests/test_lint_recipe.py +++ b/tests/test_lint_recipe.py @@ -13,7 +13,7 @@ import conda_smithy.lint_recipe as linter from conda_smithy.linter.utils import VALID_PYTHON_BUILD_BACKENDS -from conda_smithy.utils import get_yaml +from conda_smithy.utils import get_yaml, render_meta_yaml _thisdir = os.path.abspath(os.path.dirname(__file__)) @@ -3163,7 +3163,7 @@ def test_hint_noarch_python_use_python_min( meta_str, expected_hints, ): - meta = get_yaml().load(meta_str) + meta = get_yaml().load(render_meta_yaml(meta_str)) lints = [] hints = [] linter.run_conda_forge_specific( @@ -3250,7 +3250,7 @@ def test_hint_noarch_python_use_python_min_v1( meta_str, expected_hints, ): - meta = get_yaml().load(meta_str) + meta = get_yaml().load(render_meta_yaml(meta_str.replace("${{", "{{"))) lints = [] hints = [] linter.run_conda_forge_specific(