diff --git a/conda_smithy/lint_recipe.py b/conda_smithy/lint_recipe.py index 15996bd68..5d1baaa49 100644 --- a/conda_smithy/lint_recipe.py +++ b/conda_smithy/lint_recipe.py @@ -1342,7 +1342,6 @@ def main_debug(): lints, hints = main(rel_path, False, True) messages = [] if lints: - all_pass = False messages.append( "\nFor **{}**:\n\n{}".format( rel_path, "\n".join("* {}".format(lint) for lint in lints) diff --git a/tests/test_lint_recipe.py b/tests/test_lint_recipe.py index d8aa59f85..f0fd4d8ac 100644 --- a/tests/test_lint_recipe.py +++ b/tests/test_lint_recipe.py @@ -1772,7 +1772,7 @@ def assert_jinja(jinja_var, is_good=True): assert_jinja('{% set version= "0.27.3"%}', is_good=False) -class TestLintifyForgeYamlHintExtraFields(unittest.TestCase): +class TestLintifyForgeYamlHintExtraFields: def test_extra_build_platforms_platform(self): forge_yml = { "build_platform": { @@ -1783,11 +1783,9 @@ def test_extra_build_platforms_platform(self): hints = linter._forge_yaml_hint_extra_fields(forge_yml) - self.assertEquals(len(hints), 1) + assert len(hints) == 1 - self.assertIn( - "Unexpected key build_platform.UNKNOWN_PLATFORM", hints[0] - ) + assert "Unexpected key build_platform.UNKNOWN_PLATFORM" in hints[0] def test_extra_os_version_platform(self): forge_yml = { @@ -1798,9 +1796,9 @@ def test_extra_os_version_platform(self): hints = linter._forge_yaml_hint_extra_fields(forge_yml) - self.assertEquals(len(hints), 1) + assert len(hints) == 1 - self.assertIn("Unexpected key os_version.UNKNOWN_PLATFORM_2", hints[0]) + assert "Unexpected key os_version.UNKNOWN_PLATFORM_2" in hints[0] def test_extra_provider_platform(self): forge_yml = { @@ -1812,9 +1810,36 @@ def test_extra_provider_platform(self): hints = linter._forge_yaml_hint_extra_fields(forge_yml) - self.assertEquals(len(hints), 1) + assert len(hints) == 1 + + assert "Unexpected key provider.UNKNOWN_PLATFORM_3" in hints[0] + + @pytest.mark.parametrize( + "top_field", ["settings_linux", "settings_osx", "settings_win"] + ) + def test_extra_azure_runner_settings_no_hint(self, top_field: str): + forge_yml = { + "azure": { + top_field: { + "EXTRA_FIELD": "EXTRA_VALUE", + } + } + } + + hints = linter._forge_yaml_hint_extra_fields(forge_yml) + + assert len(hints) == 0 + + def test_extra_conda_build_config_no_hint(self): + forge_yml = { + "conda_build": { + "EXTRA_FIELD": "EXTRA_VALUE", + } + } + + hints = linter._forge_yaml_hint_extra_fields(forge_yml) - self.assertIn("Unexpected key provider.UNKNOWN_PLATFORM_3", hints[0]) + assert len(hints) == 0 if __name__ == "__main__":