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

Use new ansible-compat verbosity levels #3975

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/lock-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile --no-annotate --output-file=.config/lock-requirements.txt --strip-extras --unsafe-package=resolvelib --unsafe-package=ruamel-yaml-clib pyproject.toml
#
ansible-compat==4.1.10
ansible-compat==4.1.11
ansible-core==2.16.0
attrs==23.1.0
black==23.10.1
Expand Down
2 changes: 1 addition & 1 deletion .config/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile --extra=docs --extra=test --no-annotate --output-file=.config/requirements.txt --strip-extras --unsafe-package=resolvelib --unsafe-package=ruamel-yaml-clib pyproject.toml
#
ansible-compat==4.1.10
ansible-compat==4.1.11
ansible-core==2.16.0
astroid==3.0.1
attrs==23.1.0
Expand Down
2 changes: 1 addition & 1 deletion .config/runtime-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Special order section for helping pip:
will-not-work-on-windows-try-from-wsl-instead; platform_system=='Windows'
ansible-core>=2.12.0 # GPLv3
ansible-compat>=4.1.10 # GPLv3
ansible-compat>=4.1.11 # GPLv3
# alphabetically sorted:
black>=22.8.0 # MIT
filelock>=3.3.0 # The Unlicense
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ repos:
# empty args needed in order to match mypy cli behavior
args: [--strict]
additional_dependencies:
- ansible-compat>=4.1.10
- ansible-compat>=4.1.11
- black>=22.10.0
- cryptography>=39.0.1
- filelock>=3.12.2
Expand Down Expand Up @@ -180,7 +180,7 @@ repos:
args:
- --output-format=colorized
additional_dependencies:
- ansible-compat>=4.1.10
- ansible-compat>=4.1.11
- ansible-core>=2.14.0
- black>=22.10.0
- docutils
Expand Down
6 changes: 5 additions & 1 deletion src/ansiblelint/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ def __init__(self, options: Options):
self.formatter = formatter_factory(options.cwd, options.display_relative_path)

# Without require_module, our _set_collections_basedir may fail
self.runtime = Runtime(isolated=True, require_module=True)
self.runtime = Runtime(
isolated=True,
require_module=True,
verbosity=options.verbosity,
)

def render_matches(self, matches: list[MatchError]) -> None:
"""Display given matches (if they are not fixed)."""
Expand Down
4 changes: 4 additions & 0 deletions test/test_verbosity.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest

from ansiblelint.testing import run_ansible_lint
from ansiblelint.text import strip_ansi_escape


# substrs is a list of tuples, where:
Expand Down Expand Up @@ -83,6 +84,9 @@ def test_verbosity(
else:
result = run_ansible_lint(str(fakerole), cwd=project_path)

result.stderr = strip_ansi_escape(result.stderr)
result.stdout = strip_ansi_escape(result.stdout)
assert result.returncode == 2, result
for substr, invert in substrs:
if invert:
assert substr not in result.stderr, result.stderr
Expand Down