Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ansible-lint for openSUSE:Factory 
checked in at 2022-11-04 17:34:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ansible-lint (Old)
 and      /work/SRC/openSUSE:Factory/.ansible-lint.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ansible-lint"

Fri Nov  4 17:34:36 2022 rev:8 rq:1032637 version:6.8.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/ansible-lint/ansible-lint.changes        
2022-10-29 20:18:28.658648907 +0200
+++ /work/SRC/openSUSE:Factory/.ansible-lint.new.2275/ansible-lint.changes      
2022-11-04 17:36:50.677399640 +0100
@@ -1,0 +2,14 @@
+Tue Nov  1 07:16:16 UTC 2022 - Johannes Kastl <ka...@b1-systems.de>
+
+- update to 6.8.5:
+  * Bugfixes
+    - Fix offline mode (#2643) @ssbarnea
+    - Delay app initialization (#2642) @ssbarnea
+    - Fix pip version check (#2641) @ssbarnea
+    - Fix progressive mode exit code (#2638) @ssbarnea
+    - role-name[path]: Now detects use of paths when including roles (#2532) 
@ssbarnea
+    - Avoid altering severity based on level on codeclimate output (#2637) 
@ssbarnea
+    - Do not emit fqcn[action-core] when ansible.legacy is used for builtin 
modules (#2634) @felixfontein
+    - Avoid upgrade recommendation for bleeding edge users (#2630) @ssbarnea
+
+-------------------------------------------------------------------

Old:
----
  ansible-lint-6.8.4.tar.gz

New:
----
  ansible-lint-6.8.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ansible-lint.spec ++++++
--- /var/tmp/diff_new_pack.lA0xix/_old  2022-11-04 17:36:51.245402607 +0100
+++ /var/tmp/diff_new_pack.lA0xix/_new  2022-11-04 17:36:51.249402628 +0100
@@ -20,7 +20,7 @@
 %global lib_name ansiblelint
 %{?python_enable_dependency_generator}
 Name:           ansible-lint
-Version:        6.8.4
+Version:        6.8.5
 Release:        0%{?dist}
 Summary:        Best practices checker for Ansible
 License:        MIT

++++++ ansible-lint-6.8.4.tar.gz -> ansible-lint-6.8.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/.git_archival.txt 
new/ansible-lint-6.8.5/.git_archival.txt
--- old/ansible-lint-6.8.4/.git_archival.txt    2022-10-27 21:15:09.000000000 
+0200
+++ new/ansible-lint-6.8.5/.git_archival.txt    2022-11-01 00:04:14.000000000 
+0100
@@ -1 +1 @@
-ref-names: tag: v6.8.4
+ref-names: HEAD -> main, tag: v6.8.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/.github/workflows/tox.yml 
new/ansible-lint-6.8.5/.github/workflows/tox.yml
--- old/ansible-lint-6.8.4/.github/workflows/tox.yml    2022-10-27 
21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/.github/workflows/tox.yml    2022-11-01 
00:04:14.000000000 +0100
@@ -166,7 +166,7 @@
       WSLENV: FORCE_COLOR:PYTEST_REQPASS:TOXENV:TOX_PARALLEL_NO_SPINNER
       # Number of expected test passes, safety measure for accidental skip of
       # tests. Update value if you add/remove tests.
-      PYTEST_REQPASS: 710
+      PYTEST_REQPASS: 713
 
     steps:
       - name: Activate WSL1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/.pre-commit-config.yaml 
new/ansible-lint-6.8.5/.pre-commit-config.yaml
--- old/ansible-lint-6.8.4/.pre-commit-config.yaml      2022-10-27 
21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/.pre-commit-config.yaml      2022-11-01 
00:04:14.000000000 +0100
@@ -141,7 +141,7 @@
         # empty args needed in order to match mypy cli behavior
         args: [--strict]
         additional_dependencies:
-          - ansible-compat>=2.2.0
+          - ansible-compat>=2.2.3
           - ansible-core
           - black
           - filelock
@@ -167,7 +167,7 @@
     hooks:
       - id: pylint
         additional_dependencies:
-          - ansible-compat>=2.2.0
+          - ansible-compat>=2.2.3
           - ansible-core
           - black
           - docutils
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/conftest.py 
new/ansible-lint-6.8.5/conftest.py
--- old/ansible-lint-6.8.4/conftest.py  2022-10-27 21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/conftest.py  2022-11-01 00:04:14.000000000 +0100
@@ -6,7 +6,6 @@
 from typing import Any
 
 import pytest
-from ansible.module_utils.common.yaml import HAS_LIBYAML
 
 # checking if user is running pytest without installing test dependencies:
 missing = []
@@ -22,8 +21,19 @@
 # we need to be sure that we have the requirements installed as some tests
 # might depend on these.
 try:
+    from ansible_compat.prerun import get_cache_dir
+
+    cache_dir = get_cache_dir(".")
     subprocess.check_output(
-        ["ansible-galaxy", "collection", "install", "-r", "requirements.yml"],
+        [
+            "ansible-galaxy",
+            "collection",
+            "install",
+            "-p",
+            f"{cache_dir}/collections",
+            "-r",
+            "requirements.yml",
+        ],
         stderr=subprocess.PIPE,
         text=True,
     )
@@ -31,6 +41,11 @@
     print(f"{exc}\n{exc.stderr}\n{exc.stdout}", file=sys.stderr)
     sys.exit(1)
 
+# flake8: noqa: E402
+from ansible.module_utils.common.yaml import (  # pylint: 
disable=wrong-import-position
+    HAS_LIBYAML,
+)
+
 if not HAS_LIBYAML and sys.version_info >= (3, 9, 0):
     # While presence of libyaml is not required for runtime, we keep this error
     # fatal here in order to be sure that we spot libyaml errors during 
testing.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansible-lint-6.8.4/examples/roles/subfolder/other_role/tasks/main.yml 
new/ansible-lint-6.8.5/examples/roles/subfolder/other_role/tasks/main.yml
--- old/ansible-lint-6.8.4/examples/roles/subfolder/other_role/tasks/main.yml   
1970-01-01 01:00:00.000000000 +0100
+++ new/ansible-lint-6.8.5/examples/roles/subfolder/other_role/tasks/main.yml   
2022-11-01 00:04:14.000000000 +0100
@@ -0,0 +1,4 @@
+---
+- name: Foo
+  debug:
+    msg: "Hello!"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/mypy.ini 
new/ansible-lint-6.8.5/mypy.ini
--- old/ansible-lint-6.8.4/mypy.ini     2022-10-27 21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/mypy.ini     2022-11-01 00:04:14.000000000 +0100
@@ -23,6 +23,9 @@
 # # https://github.com/box/flaky/issues/170
 ignore_missing_imports = True
 
+[mypy-pip.*]
+ignore_missing_imports = True
+
 [mypy-pytest]
 ignore_missing_imports = True
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/requirements.txt 
new/ansible-lint-6.8.5/requirements.txt
--- old/ansible-lint-6.8.4/requirements.txt     2022-10-27 21:15:09.000000000 
+0200
+++ new/ansible-lint-6.8.5/requirements.txt     2022-11-01 00:04:14.000000000 
+0100
@@ -5,7 +5,7 @@
 #    pip-compile --extra=docs --extra=test --no-annotate 
--output-file=requirements.txt --strip-extras --unsafe-package=ansible-core 
setup.cfg
 #
 alabaster==0.7.12
-ansible-compat==2.2.1
+ansible-compat==2.2.3
 ansible-pygments==0.1.1
 astroid==2.12.12
 attrs==22.1.0
@@ -22,7 +22,7 @@
 cryptography==38.0.1
 dill==0.3.6
 docutils==0.17.1
-exceptiongroup==1.0.0rc9
+exceptiongroup==1.0.0
 execnet==1.9.0
 filelock==3.8.0
 flake8==5.0.4
@@ -35,7 +35,7 @@
 isort==5.10.1
 jinja2==3.1.2
 jsonschema==4.16.0
-lazy-object-proxy==1.7.1
+lazy-object-proxy==1.8.0
 markdown-it-py==2.1.0
 markupsafe==2.1.1
 mccabe==0.7.0
@@ -60,6 +60,7 @@
 pyparsing==3.0.9
 pyrsistent==0.18.1
 pytest==7.2.0
+pytest-mock==3.10.0
 pytest-plus==0.2
 pytest-xdist==3.0.2
 pytz==2022.5
@@ -83,7 +84,7 @@
 sphinxcontrib-serializinghtml==1.1.5
 subprocess-tee==0.3.5
 tomli==2.0.1
-tomlkit==0.11.5
+tomlkit==0.11.6
 typing-extensions==4.4.0
 urllib3==1.26.12
 wcmatch==8.4.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/setup.cfg 
new/ansible-lint-6.8.5/setup.cfg
--- old/ansible-lint-6.8.4/setup.cfg    2022-10-27 21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/setup.cfg    2022-11-01 00:04:14.000000000 +0100
@@ -67,7 +67,7 @@
 
 # These are required in actual runtime:
 install_requires =
-  ansible-compat>=2.2.1  # GPLv3
+  ansible-compat>=2.2.3  # GPLv3
   ansible-core>=2.12.0  # GPLv3
   black>=22.1.0  # MIT
   filelock  # The Unlicense
@@ -100,6 +100,7 @@
   coverage[toml] >= 6.4.4
   flaky >= 3.7.0
   pytest >= 7.2.0
+  pytest-mock
   pytest-plus >= 0.2 # for PYTEST_REQPASS
   pytest-xdist >= 2.1.0
   psutil  # soft-dep of pytest-xdist
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/src/ansiblelint/__main__.py 
new/ansible-lint-6.8.5/src/ansiblelint/__main__.py
--- old/ansible-lint-6.8.4/src/ansiblelint/__main__.py  2022-10-27 
21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/src/ansiblelint/__main__.py  2022-11-01 
00:04:14.000000000 +0100
@@ -187,14 +187,15 @@
         console.print(
             f"ansible-lint [repr.number]{__version__}[/] using ansible 
[repr.number]{ansible_version()}[/]"
         )
-        console.print(get_version_warning())
+        msg = get_version_warning()
+        if msg:
+            console.print(msg)
         sys.exit(0)
 
     initialize_logger(options.verbosity)
     _logger.debug("Options: %s", options)
     _logger.debug(os.getcwd())
 
-    app = get_app(offline=options.offline)
     # pylint: disable=import-outside-toplevel
     from ansiblelint.rules import RulesCollection
     from ansiblelint.runner import _get_matches
@@ -210,6 +211,7 @@
     if options.listrules or options.listtags:
         return _do_list(rules)
 
+    app = get_app(offline=options.offline)
     if isinstance(options.tags, str):
         options.tags = options.tags.split(",")
     result = _get_matches(rules, options)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/src/ansiblelint/app.py 
new/ansible-lint-6.8.5/src/ansiblelint/app.py
--- old/ansible-lint-6.8.4/src/ansiblelint/app.py       2022-10-27 
21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/src/ansiblelint/app.py       2022-11-01 
00:04:14.000000000 +0100
@@ -193,7 +193,7 @@
                 "because 'yaml' is in 'skip_list'."
             )
 
-        if summary.failures:
+        if mark_as_success and summary.failures and not 
self.options.progressive:
             mark_as_success = False
 
         if not self.options.quiet:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/src/ansiblelint/config.py 
new/ansible-lint-6.8.5/src/ansiblelint/config.py
--- old/ansible-lint-6.8.4/src/ansiblelint/config.py    2022-10-27 
21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/src/ansiblelint/config.py    2022-11-01 
00:04:14.000000000 +0100
@@ -37,6 +37,7 @@
     "name[play]",
     "role-name",
     "warning[empty-playbook]",  # because ansible considers it warning only
+    "role-name[path]",  # too new
 ]
 
 DEFAULT_KINDS = [
@@ -224,7 +225,6 @@
         with warnings.catch_warnings(record=True):
             warnings.simplefilter("always")
             # pylint: disable=import-outside-toplevel
-            from pip._internal.exceptions import UninstallationError
             from pip._internal.metadata import get_default_environment
             from pip._internal.req.req_uninstall import uninstallation_paths
 
@@ -236,7 +236,8 @@
             else:
                 logging.debug("Skipping %s as it is not installed.", 
package_name)
                 use_pip = False
-    except (UninstallationError, AttributeError, ImportError) as exc:
+    # pylint: disable=broad-except
+    except Exception as exc:
         # On Fedora 36, we got a AttributeError exception from pip that we 
want to avoid
         logging.debug(exc)
         use_pip = False
@@ -285,8 +286,8 @@
     elif current_version < new_version:
         msg = f"""[warning]A new release of ansible-lint is available: 
[red]{current_version}[/] ??? [green][link={html_url}]{new_version}[/][/][/]"""
 
-    pip = guess_install_method()
-    if pip:
-        msg += f" Upgrade by running: [info]{pip}[/]"
+        pip = guess_install_method()
+        if pip:
+            msg += f" Upgrade by running: [info]{pip}[/]"
 
     return msg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/src/ansiblelint/constants.py 
new/ansible-lint-6.8.5/src/ansiblelint/constants.py
--- old/ansible-lint-6.8.4/src/ansiblelint/constants.py 2022-10-27 
21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/src/ansiblelint/constants.py 2022-11-01 
00:04:14.000000000 +0100
@@ -136,8 +136,10 @@
 }
 
 ROLE_IMPORT_ACTION_NAMES = {
-    "import_role",
     "ansible.builtin.import_role",
-    "include_role",
     "ansible.builtin.include_role",
+    "ansible.legacy.import_role",
+    "ansible.legacy.include_role",
+    "import_role",
+    "include_role",
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansible-lint-6.8.4/src/ansiblelint/formatters/__init__.py 
new/ansible-lint-6.8.5/src/ansiblelint/formatters/__init__.py
--- old/ansible-lint-6.8.4/src/ansiblelint/formatters/__init__.py       
2022-10-27 21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/src/ansiblelint/formatters/__init__.py       
2022-11-01 00:04:14.000000000 +0100
@@ -151,7 +151,11 @@
             if match.rule.url:
                 # https://github.com/codeclimate/platform/issues/68
                 issue["url"] = match.rule.url
-            issue["severity"] = self._severity_to_level(match)
+            issue["severity"] = self._remap_severity(match)
+            # level is not part of CodeClimate specification, but there is
+            # no other way to expose that info. We recommend switching to
+            # SARIF format which is better suited for interoperability.
+            issue["level"] = match.level
             issue["description"] = self.escape(str(match.message))
             issue["fingerprint"] = hashlib.sha256(
                 repr(match).encode("utf-8")
@@ -174,9 +178,7 @@
         return json.dumps(result)
 
     @staticmethod
-    def _severity_to_level(match: MatchError) -> str:
-        if match.level != "error":
-            return "info"
+    def _remap_severity(match: MatchError) -> str:
         severity = match.rule.severity
 
         if severity in ["LOW"]:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/src/ansiblelint/rules/fqcn.py 
new/ansible-lint-6.8.5/src/ansiblelint/rules/fqcn.py
--- old/ansible-lint-6.8.4/src/ansiblelint/rules/fqcn.py        2022-10-27 
21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/src/ansiblelint/rules/fqcn.py        2022-11-01 
00:04:14.000000000 +0100
@@ -117,17 +117,21 @@
                 self.module_aliases[target] = target
 
         if module != self.module_aliases[module]:
-            module_alias = self.module_aliases.get(module, "")
+            module_alias = self.module_aliases[module]
             if module_alias.startswith("ansible.builtin"):
-                result.append(
-                    self.create_matcherror(
-                        message=f"Use FQCN for builtin module actions 
({module}).",
-                        details=f"Use `ansible.builtin.{module}` or 
`ansible.legacy.{module}` instead.",
-                        filename=file,
-                        linenumber=task["__line__"],
-                        tag="fqcn[action-core]",
-                    )
+                legacy_module = module_alias.replace(
+                    "ansible.builtin.", "ansible.legacy.", 1
                 )
+                if module != legacy_module:
+                    result.append(
+                        self.create_matcherror(
+                            message=f"Use FQCN for builtin module actions 
({module}).",
+                            details=f"Use `{module_alias}` or 
`{legacy_module}` instead.",
+                            filename=file,
+                            linenumber=task["__line__"],
+                            tag="fqcn[action-core]",
+                        )
+                    )
             else:
                 if module.count(".") < 2:
                     result.append(
@@ -172,6 +176,8 @@
     community.general.system.sudoers:
       name: should-not-be-here
       state: absent
+  - name: Command with legacy FQCN
+    ansible.legacy.command: echo This rule should not get matched by the fqcn 
rule
     """
 
     FAIL_PLAY = """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansible-lint-6.8.4/src/ansiblelint/rules/role_name.md 
new/ansible-lint-6.8.5/src/ansiblelint/rules/role_name.md
--- old/ansible-lint-6.8.4/src/ansiblelint/rules/role_name.md   2022-10-27 
21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/src/ansiblelint/rules/role_name.md   2022-11-01 
00:04:14.000000000 +0100
@@ -7,6 +7,10 @@
 
 For more information see the [roles 
directory](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections_structure.html#roles-directory)
 topic in Ansible documentation.
 
+`role-name[path]` message tells you to avoid using paths when importing roles.
+You should only rely on Ansible's ability to find the role and refer to them
+using fully qualified names.
+
 ## Problematic Code
 
 ```yaml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansible-lint-6.8.4/src/ansiblelint/rules/role_name.py 
new/ansible-lint-6.8.5/src/ansiblelint/rules/role_name.py
--- old/ansible-lint-6.8.4/src/ansiblelint/rules/role_name.py   2022-10-27 
21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/src/ansiblelint/rules/role_name.py   2022-11-01 
00:04:14.000000000 +0100
@@ -23,8 +23,9 @@
 
 import re
 from pathlib import Path
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any
 
+from ansiblelint.constants import ROLE_IMPORT_ACTION_NAMES
 from ansiblelint.file_utils import Lintable
 from ansiblelint.rules import AnsibleLintRule
 from ansiblelint.utils import parse_yaml_from_file
@@ -53,12 +54,30 @@
     severity = "HIGH"
     done: list[str] = []  # already noticed roles list
     tags = ["deprecations", "metadata"]
-    version_added = "v4.3.0"
+    version_added = "v6.8.5"
 
     def __init__(self) -> None:
         """Save precompiled regex."""
         self._re = re.compile(ROLE_NAME_REGEX)
 
+    def matchtask(
+        self, task: dict[str, Any], file: Lintable | None = None
+    ) -> list[MatchError]:
+        results = []
+        if task["action"]["__ansible_module__"] in ROLE_IMPORT_ACTION_NAMES:
+            name = task["action"].get("name", "")
+            # breakpoint()
+            if "/" in name:
+                results.append(
+                    self.create_matcherror(
+                        "Avoid using paths when importing roles.",
+                        filename=file,
+                        linenumber=task["__line__"],
+                        tag=f"{self.id}[path]",
+                    )
+                )
+        return results
+
     def matchdir(self, lintable: Lintable) -> list[MatchError]:
         return self.matchyaml(lintable)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ansible-lint-6.8.4/src/ansiblelint/testing/__init__.py 
new/ansible-lint-6.8.5/src/ansiblelint/testing/__init__.py
--- old/ansible-lint-6.8.4/src/ansiblelint/testing/__init__.py  2022-10-27 
21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/src/ansiblelint/testing/__init__.py  2022-11-01 
00:04:14.000000000 +0100
@@ -19,10 +19,6 @@
 else:
     CompletedProcess = subprocess.CompletedProcess
 
-# Emulate command line execution initialization as without it Ansible module
-# would be loaded with incomplete module/role/collection list.
-app = get_app(offline=True)
-
 # pylint: disable=wrong-import-position
 from ansiblelint.runner import Runner  # noqa: E402
 
@@ -30,12 +26,20 @@
 class RunFromText:
     """Use Runner on temp files created from testing text snippets."""
 
+    app = None
+
     def __init__(self, collection: RulesCollection) -> None:
         """Initialize a RunFromText instance with rules collection."""
+        # Emulate command line execution initialization as without it Ansible 
module
+        # would be loaded with incomplete module/role/collection list.
+        if not self.app:
+            self.app = get_app(offline=True)
+
         self.collection = collection
 
     def _call_runner(self, path: str) -> list[MatchError]:
         runner = Runner(path, rules=self.collection)
+        # breakpoint()
         return runner.run()
 
     def run(self, filename: str) -> list[MatchError]:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/test/test_eco.py 
new/ansible-lint-6.8.5/test/test_eco.py
--- old/ansible-lint-6.8.4/test/test_eco.py     2022-10-27 21:15:09.000000000 
+0200
+++ new/ansible-lint-6.8.5/test/test_eco.py     2022-11-01 00:04:14.000000000 
+0100
@@ -22,6 +22,18 @@
 }
 
 
+def sanitize_output(text: str) -> str:
+    """Make the output less likely to vary between runs or minor changes."""
+    # replace full path to home directory with ~.
+    result = text.replace(os.path.expanduser("~"), "~")
+    # removes warning related to PATH alteration
+    result = re.sub(
+        r"^WARNING: PATH altered to include.+\n", "", result, 
flags=re.MULTILINE
+    )
+
+    return result
+
+
 @pytest.mark.eco()
 @pytest.mark.parametrize(("repo"), (eco_repos.keys()))
 def test_eco(repo: str) -> None:
@@ -55,19 +67,10 @@
             cwd=f"{cache_dir}/{repo}",
         )
 
-        def sanitize_output(text: str) -> str:
-            """Make the output less likely to vary between runs or minor 
changes."""
-            # replace full path to home directory with ~.
-            result = text.replace(os.path.expanduser("~"), "~")
-            # removes warning related to PATH alteration
-            result = re.sub(
-                r"^WARNING: PATH altered to include.+\n", "", result, 
flags=re.MULTILINE
-            )
-
-            return result
-
         # Ensure that cmd looks the same for later diff, even if the path was 
different
         result.args[0] = "ansible-lint"
+        # sort stderr because parallel runs can
+        result.stderr = "\n".join(sorted(result.stderr.split("\n")))
 
         result_txt = f"CMD: {shlex.join(result.args)}\n\nRC: 
{result.returncode}\n\nSTDERR:\n{result.stderr}\n\nSTDOUT:\n{result.stdout}"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/test/test_examples.py 
new/ansible-lint-6.8.5/test/test_examples.py
--- old/ansible-lint-6.8.4/test/test_examples.py        2022-10-27 
21:15:09.000000000 +0200
+++ new/ansible-lint-6.8.5/test/test_examples.py        2022-11-01 
00:04:14.000000000 +0100
@@ -5,6 +5,7 @@
 import pytest
 from _pytest.fixtures import FixtureRequest
 
+from ansiblelint.app import get_app
 from ansiblelint.rules import RulesCollection
 from ansiblelint.runner import Runner
 from ansiblelint.testing import run_ansible_lint
@@ -49,10 +50,11 @@
 
 def test_example_custom_module(default_rules_collection: RulesCollection) -> 
None:
     """custom_module.yml is expected to pass."""
+    app = get_app(offline=True)
     result = Runner(
         "examples/playbooks/custom_module.yml", rules=default_rules_collection
     ).run()
-    assert len(result) == 0
+    assert len(result) == 0, f"{app.runtime.cache_dir}"
 
 
 def test_full_vault(default_rules_collection: RulesCollection) -> None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/test/test_main.py 
new/ansible-lint-6.8.5/test/test_main.py
--- old/ansible-lint-6.8.4/test/test_main.py    2022-10-27 21:15:09.000000000 
+0200
+++ new/ansible-lint-6.8.5/test/test_main.py    2022-11-01 00:04:14.000000000 
+0100
@@ -2,10 +2,14 @@
 import os
 import subprocess
 import sys
+import time
 from pathlib import Path
+from typing import Any
 
 import pytest
 
+from ansiblelint.config import get_version_warning
+
 
 @pytest.mark.parametrize(
     ("expected_warning"),
@@ -30,3 +34,34 @@
     )
     warning_found = "PATH altered to include" in proc.stderr
     assert warning_found is expected_warning
+
+
+@pytest.mark.parametrize(
+    ("ver_diff", "found", "check", "outlen"),
+    (
+        ("v1.2.2", True, "pre-release", 1),
+        ("v1.2.3", False, "", 1),
+        ("v1.2.4", True, "new release", 2),
+    ),
+)
+def test_get_version_warning(
+    mocker: Any, ver_diff: str, found: bool, check: str, outlen: int
+) -> None:
+    """Assert get_version_warning working as expected."""
+    data = '{"html_url": "https://127.0.0.1";, "tag_name": "' + f"{ver_diff}" + 
'"}'
+    # simulate cache file
+    mocker.patch("os.path.exists", return_value=True)
+    mocker.patch("os.path.getmtime", return_value=time.time())
+    mocker.patch("builtins.open", mocker.mock_open(read_data=data))
+    # overwrite ansible-lint version
+    mocker.patch("ansiblelint.config.__version__", "1.2.3")
+    # overwrite install method to custom one. This one will increase msg line 
count
+    # to easily detect unwanted call to it.
+    mocker.patch("ansiblelint.config.guess_install_method", return_value="\n")
+    msg = get_version_warning()
+
+    if not found:
+        assert msg == check
+    else:
+        assert check in msg
+    assert len(msg.split("\n")) == outlen
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-lint-6.8.4/test/test_utils.py 
new/ansible-lint-6.8.5/test/test_utils.py
--- old/ansible-lint-6.8.4/test/test_utils.py   2022-10-27 21:15:09.000000000 
+0200
+++ new/ansible-lint-6.8.5/test/test_utils.py   2022-11-01 00:04:14.000000000 
+0100
@@ -34,6 +34,7 @@
 from _pytest.logging import LogCaptureFixture
 from _pytest.monkeypatch import MonkeyPatch
 from ansible.utils.sentinel import Sentinel
+from ansible_compat.runtime import Runtime
 
 from ansiblelint import cli, constants, utils
 from ansiblelint.__main__ import initialize_logger
@@ -42,6 +43,8 @@
 from ansiblelint.file_utils import Lintable
 from ansiblelint.testing import run_ansible_lint
 
+runtime = Runtime()
+
 
 @pytest.mark.parametrize(
     ("string", "expected_cmd", "expected_args", "expected_kwargs"),
@@ -251,7 +254,9 @@
     ("role", "expect_warning"),
     (
         ("template_lookup", False),
-        ("template_lookup_missing", True),
+        # With 2.15 ansible replaced the runtime Warning about inability to
+        # open a file in file lookup with a full error.
+        ("template_lookup_missing", runtime.version_in_range(upper="2.14")),
     ),
 )
 def test_template_lookup(role: str, expect_warning: bool) -> None:

Reply via email to