Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up tests: xfail git windows and ugly jinja2 test #372

Open
bkreider opened this issue Jan 9, 2025 · 0 comments
Open

Clean up tests: xfail git windows and ugly jinja2 test #372

bkreider opened this issue Jan 9, 2025 · 0 comments

Comments

@bkreider
Copy link
Contributor

bkreider commented Jan 9, 2025

In my PR, i xfail this test otherwise it hard fails. See: https://github.com/anaconda/anaconda-linter/pull/369/files#diff-dab905a3625ce6df77f61b134d2b2e61bc0d09609bf902c2a5092f45730f8280

See the commentary for the test here: https://github.com/anaconda/anaconda-linter/pull/369/files#diff-11b4c502df02b23a6f1ff6164b6f6145f03cb413b2beef3dd6a5c1c11653bc23

Code:

# TODO figure out: 1 test fails if we remove this retry mechanism. Can we write the test differently so that
# we don't have conditional logic in our tests?
if not jinja_func == "pin_subpackage('dotnet-runtime', exact=True, badParam=False)":
print(jinja_func)
recipe = Recipe.from_string(
recipe_text=yaml_str, renderer=RendererType.RUAMEL, variant={"target_platform": "dummy-platform"}
)
linter.lint([recipe])
messages = linter.get_messages()
return messages
# Only this test needs the weird exception handling
try:
recipe = Recipe.from_string(recipe_text=yaml_str, renderer=RendererType.RUAMEL)
except RecipeError as exc:
recipe = Recipe("")
check_cls = lint.recipe_error_to_lint_check.get(exc.__class__, lint.linter_failure)
messages = [check_cls.make_message(recipe=recipe, line=getattr(exc, "line"))]
return messages

        # TODO figure out: 1 test fails if we remove this retry mechanism. Can we write the test differently so that
        # we don't have conditional logic in our tests?
        if not jinja_func == "pin_subpackage('dotnet-runtime', exact=True, badParam=False)":
            print(jinja_func)
            recipe = Recipe.from_string(
                recipe_text=yaml_str, renderer=RendererType.RUAMEL, variant={"target_platform": "dummy-platform"}
            )
            linter.lint([recipe])
            messages = linter.get_messages()
            return messages

        # Only this test needs the weird exception handling
        try:
            recipe = Recipe.from_string(recipe_text=yaml_str, renderer=RendererType.RUAMEL)
        except RecipeError as exc:
            recipe = Recipe("")
            check_cls = lint.recipe_error_to_lint_check.get(exc.__class__, lint.linter_failure)
            messages = [check_cls.make_message(recipe=recipe, line=getattr(exc, "line"))]
            return messages
@bkreider bkreider mentioned this issue Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant