Skip to content

Commit

Permalink
Fix only builtins fail test
Browse files Browse the repository at this point in the history
With `config-file=/dev/null` the linting fails with `syntax-check[specific]`
and the only-builtins part is never executed.
Use the global config which properly mocks the fake collection and
assert we raised a warning, not a failure.

Fixes: 6e31f19
  • Loading branch information
evgeni committed Nov 23, 2022
1 parent 9d05fba commit 397ad6f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ansiblelint/rules/only_builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ def matchtask(
ansible.builtin.shell: echo This rule should not get matched by the only-builtins rule
"""

def test_only_builtin_fail() -> None:
def test_only_builtins_fail() -> None:
"""Test rule matches."""
result = run_ansible_lint(
"--config-file=/dev/null",
"--strict",
"--warn-list=",
"--enable-list",
Expand All @@ -60,8 +59,8 @@ def test_only_builtin_fail() -> None:
)
assert result.returncode == VIOLATIONS_FOUND_RC
assert "Failed" in result.stderr
assert "1 failure(s)" in result.stderr
assert "only-builtins" in result.stdout
assert "1 warning(s)" in result.stderr
assert "only-builtins: Use only builtin actions" in result.stdout

@pytest.mark.parametrize(
"rule_runner", (OnlyBuiltinsRule,), indirect=["rule_runner"]
Expand Down

0 comments on commit 397ad6f

Please sign in to comment.