Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-ansible-compat for 
openSUSE:Factory checked in at 2025-02-09 20:01:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-ansible-compat (Old)
 and      /work/SRC/openSUSE:Factory/.python-ansible-compat.new.2316 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-ansible-compat"

Sun Feb  9 20:01:12 2025 rev:34 rq:1244229 version:25.1.2

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-ansible-compat/python-ansible-compat.changes  
    2025-01-29 16:12:08.979873552 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-ansible-compat.new.2316/python-ansible-compat.changes
    2025-02-09 20:01:30.782594813 +0100
@@ -1,0 +2,11 @@
+Fri Feb  7 17:17:53 UTC 2025 - Johannes Kastl 
<opensuse_buildserv...@ojkastl.de>
+
+- update to 25.1.2:
+  * Bugfixes
+    - Avoid get_cache_dir errors with read only virtualenvs (#457)
+      @ssbarnea
+    - Simplify module presence testing (#460) @ssbarnea
+    - Fix grammatical error in collection path info message (#456)
+      @bluikko
+
+-------------------------------------------------------------------

Old:
----
  python-ansible-compat-25.1.1.tar.gz

New:
----
  python-ansible-compat-25.1.2.tar.gz

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

Other differences:
------------------
++++++ python-ansible-compat.spec ++++++
--- /var/tmp/diff_new_pack.jBCWwv/_old  2025-02-09 20:01:32.722674579 +0100
+++ /var/tmp/diff_new_pack.jBCWwv/_new  2025-02-09 20:01:32.742675401 +0100
@@ -24,7 +24,7 @@
 %endif
 
 Name:           python-ansible-compat
-Version:        25.1.1
+Version:        25.1.2
 Release:        0
 Summary:        Compatibility shim for Ansible 2.9 and newer
 License:        MIT

++++++ python-ansible-compat-25.1.1.tar.gz -> 
python-ansible-compat-25.1.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/.config/constraints.txt 
new/ansible-compat-25.1.2/.config/constraints.txt
--- old/ansible-compat-25.1.1/.config/constraints.txt   2025-01-28 
15:14:46.000000000 +0100
+++ new/ansible-compat-25.1.2/.config/constraints.txt   2025-02-05 
11:04:35.000000000 +0100
@@ -2,15 +2,15 @@
 #    tox run deps
 argparse-manpage==4.6     # via ansible-compat (pyproject.toml)
 attrs==25.1.0             # via jsonschema, referencing
-babel==2.16.0             # via mkdocs-material
-beautifulsoup4==4.12.3    # via linkchecker, mkdocs-htmlproofer-plugin
-black==24.10.0            # via ansible-compat (pyproject.toml)
+babel==2.17.0             # via mkdocs-material
+beautifulsoup4==4.13.1    # via linkchecker, mkdocs-htmlproofer-plugin
+black==25.1.0             # via ansible-compat (pyproject.toml)
 cairocffi==1.7.1          # via cairosvg
 cairosvg==2.7.1           # via mkdocs-ansible
-certifi==2024.12.14       # via requests
+certifi==2025.1.31        # via requests
 cffi==1.17.1              # via cairocffi, cryptography
 charset-normalizer==3.4.1  # via requests
-click==8.1.8              # via black, mkdocs, mkdocstrings
+click==8.1.8              # via black, mkdocs
 colorama==0.4.6           # via griffe, mkdocs-material
 coverage==7.6.10          # via ansible-compat (pyproject.toml)
 cryptography==44.0.0      # via ansible-core
@@ -20,7 +20,7 @@
 dnspython==2.7.0          # via linkchecker
 exceptiongroup==1.2.2     # via pytest
 ghp-import==2.1.0         # via mkdocs
-griffe==1.5.5             # via mkdocstrings-python
+griffe==1.5.6             # via mkdocstrings-python
 hjson==3.1.0              # via mkdocs-macros-plugin, super-collections
 htmlmin2==0.1.13          # via mkdocs-minify-plugin
 idna==3.10                # via requests
@@ -39,29 +39,29 @@
 mkdocs-ansible==24.12.0   # via ansible-compat (pyproject.toml)
 mkdocs-autorefs==1.3.0    # via mkdocstrings, mkdocstrings-python
 mkdocs-gen-files==0.5.0   # via mkdocs-ansible
-mkdocs-get-deps==0.2.0    # via mkdocs
+mkdocs-get-deps==0.2.0    # via mkdocs, mkdocstrings
 mkdocs-htmlproofer-plugin==1.3.0  # via mkdocs-ansible
 mkdocs-macros-plugin==1.3.7  # via mkdocs-ansible
-mkdocs-material==9.5.50   # via mkdocs-ansible
+mkdocs-material==9.6.2    # via mkdocs-ansible
 mkdocs-material-extensions==1.3.1  # via mkdocs-ansible, mkdocs-material
 mkdocs-minify-plugin==0.8.0  # via mkdocs-ansible
 mkdocs-monorepo-plugin==1.1.0  # via mkdocs-ansible
-mkdocstrings==0.27.0      # via mkdocs-ansible, mkdocstrings-python
-mkdocstrings-python==1.13.0  # via mkdocs-ansible
+mkdocstrings==0.28.0      # via mkdocs-ansible, mkdocstrings-python
+mkdocstrings-python==1.14.0  # via mkdocs-ansible
 mypy-extensions==1.0.0    # via black
 packaging==24.2           # via ansible-core, black, mkdocs, 
mkdocs-macros-plugin, pytest, ansible-compat (pyproject.toml)
 paginate==0.5.7           # via mkdocs-material
 pathspec==0.12.1          # via black, mkdocs, mkdocs-macros-plugin
 pillow==11.1.0            # via cairosvg, mkdocs-ansible
-platformdirs==4.3.6       # via black, mkdocs-get-deps, mkdocstrings
+platformdirs==4.3.6       # via black, mkdocs-get-deps
 pluggy==1.5.0             # via pytest
 pycparser==2.22           # via cffi
 pygments==2.19.1          # via mkdocs-material
-pymdown-extensions==10.14.1  # via markdown-exec, mkdocs-ansible, 
mkdocs-material, mkdocstrings
+pymdown-extensions==10.14.3  # via markdown-exec, mkdocs-ansible, 
mkdocs-material, mkdocstrings
 pytest==8.3.4             # via pytest-instafail, pytest-mock, pytest-plus, 
ansible-compat (pyproject.toml)
 pytest-instafail==0.5.0   # via ansible-compat (pyproject.toml)
 pytest-mock==3.14.0       # via ansible-compat (pyproject.toml)
-pytest-plus==0.7.0        # via ansible-compat (pyproject.toml)
+pytest-plus==0.8.1        # via ansible-compat (pyproject.toml)
 python-dateutil==2.9.0.post0  # via ghp-import, mkdocs-macros-plugin
 python-slugify==8.0.4     # via mkdocs-monorepo-plugin
 pyyaml==6.0.2             # via ansible-core, mkdocs, mkdocs-get-deps, 
mkdocs-macros-plugin, pymdown-extensions, pyyaml-env-tag, ansible-compat 
(pyproject.toml)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/.config/pydoclint-baseline.txt 
new/ansible-compat-25.1.2/.config/pydoclint-baseline.txt
--- old/ansible-compat-25.1.1/.config/pydoclint-baseline.txt    2025-01-28 
15:14:46.000000000 +0100
+++ new/ansible-compat-25.1.2/.config/pydoclint-baseline.txt    2025-02-05 
11:04:35.000000000 +0100
@@ -127,12 +127,6 @@
     DOC601: Class `JsonSchemaError`: Class docstring contains fewer class 
attributes than actual class attributes.  (Please read 
https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to 
correctly document class attributes.)
     DOC603: Class `JsonSchemaError`: Class docstring attributes are different 
from actual class attributes. (Or could be other formatting issues: 
https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). 
Attributes in the class definition but not in the docstring: [data_path: str, 
expected: bool | int | str, found: str, json_path: str, message: str, 
relative_schema: str, schema_path: str, validator: str]. (Please read 
https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to 
correctly document class attributes.)
     DOC201: Method `JsonSchemaError.to_friendly` does not have a return 
section in docstring
-    DOC001: Function/method `validate`: Potential formatting errors in 
docstring. Error message: Expected a colon in 'SchemaError if the schema is 
invalid'. (Note: DOC001 could trigger other unrelated violations under this 
function/method too. Please fix the docstring formatting first.)
-    DOC101: Function `validate`: Docstring contains fewer arguments than in 
function signature.
-    DOC103: Function `validate`: Docstring arguments are different from 
function arguments. (Or could be other formatting issues: 
https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). 
Arguments in the function signature but not in the docstring: [data: JSON, 
schema: JSON].
-    DOC201: Function `validate` does not have a return section in docstring
-    DOC501: Function `validate` has "raise" statements, but the docstring does 
not have a "Raises" section
-    DOC503: Function `validate` exceptions in the "Raises" section in the 
docstring do not match those in the function body. Raised exceptions in the 
docstring: []. Raised exceptions in the body: ['jsonschema.SchemaError'].
 --------------------
 test/conftest.py
     DOC101: Function `runtime`: Docstring contains fewer arguments than in 
function signature.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/.git_archival.txt 
new/ansible-compat-25.1.2/.git_archival.txt
--- old/ansible-compat-25.1.1/.git_archival.txt 2025-01-28 15:14:46.000000000 
+0100
+++ new/ansible-compat-25.1.2/.git_archival.txt 2025-02-05 11:04:35.000000000 
+0100
@@ -1,4 +1,4 @@
-node: 2a8732fc7764e76ff6fdc1acd2572642ed60a541
-node-date: 2025-01-28T14:14:46Z
-describe-name: v25.1.1
-ref-names: HEAD -> main, tag: v25.1.1
+node: e980c9e7db49012c398a3cc41d0776f9e40b0744
+node-date: 2025-02-05T11:04:35+01:00
+describe-name: v25.1.2
+ref-names: HEAD -> main, tag: v25.1.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/.gitignore 
new/ansible-compat-25.1.2/.gitignore
--- old/ansible-compat-25.1.1/.gitignore        2025-01-28 15:14:46.000000000 
+0100
+++ new/ansible-compat-25.1.2/.gitignore        2025-02-05 11:04:35.000000000 
+0100
@@ -136,3 +136,4 @@
 src/ansible_compat/_version.py
 node_modules
 _readthedocs
+test/roles/acme.missing_deps/.ansible
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/.packit.yaml 
new/ansible-compat-25.1.2/.packit.yaml
--- old/ansible-compat-25.1.1/.packit.yaml      2025-01-28 15:14:46.000000000 
+0100
+++ new/ansible-compat-25.1.2/.packit.yaml      2025-02-05 11:04:35.000000000 
+0100
@@ -21,6 +21,16 @@
   - job: copr_build
     trigger: pull_request
     branch: main
+    require:
+      label:
+        present:
+          - bug
+          - dependencies
+          - enhancement
+          - major
+          - minor
+        absent:
+          - skip-changelog
     targets:
       - fedora-rawhide-x86_64
       - fedora-rawhide-aarch64
@@ -32,6 +42,16 @@
   - job: tests
     trigger: pull_request
     branch: main
+    require:
+      label:
+        present:
+          - bug
+          - dependencies
+          - enhancement
+          - major
+          - minor
+        absent:
+          - skip-changelog
     targets:
       - fedora-latest
       - fedora-rawhide
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/.pre-commit-config.yaml 
new/ansible-compat-25.1.2/.pre-commit-config.yaml
--- old/ansible-compat-25.1.1/.pre-commit-config.yaml   2025-01-28 
15:14:46.000000000 +0100
+++ new/ansible-compat-25.1.2/.pre-commit-config.yaml   2025-02-05 
11:04:35.000000000 +0100
@@ -19,7 +19,7 @@
   )$
 repos:
   - repo: https://github.com/astral-sh/ruff-pre-commit
-    rev: "v0.9.2"
+    rev: "v0.9.4"
     hooks:
       - id: ruff
         args: [--fix, --exit-non-zero-on-fix]
@@ -54,7 +54,7 @@
       - id: debug-statements
         language_version: python3
   - repo: https://github.com/codespell-project/codespell
-    rev: v2.4.0
+    rev: v2.4.1
     hooks:
       - id: codespell
   - repo: https://github.com/jsh9/pydoclint
@@ -76,7 +76,7 @@
     hooks:
       - id: toml-sort-fix
   - repo: https://github.com/psf/black
-    rev: 24.10.0
+    rev: 25.1.0
     hooks:
       - id: black
         language_version: python3
@@ -98,7 +98,7 @@
           - types-setuptools
           - types-jsonschema>=4.4.9
   - repo: https://github.com/pycqa/pylint
-    rev: v3.3.3
+    rev: v3.3.4
     hooks:
       - id: pylint
         additional_dependencies:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/.vscode/settings.json 
new/ansible-compat-25.1.2/.vscode/settings.json
--- old/ansible-compat-25.1.1/.vscode/settings.json     2025-01-28 
15:14:46.000000000 +0100
+++ new/ansible-compat-25.1.2/.vscode/settings.json     2025-02-05 
11:04:35.000000000 +0100
@@ -16,7 +16,12 @@
     "editor.defaultFormatter": "ms-python.black-formatter",
     "editor.formatOnSave": true
   },
+  "[toml]": {
+    "editor.defaultFormatter": "panekj.even-betterer-toml"
+  },
   "editor.formatOnSave": true,
+  "evenBetterToml.formatter.alignComments": false,
+  "evenBetterToml.formatter.arrayTrailingComma": true,
   "files.exclude": {
     "*.egg-info": true,
     ".pytest_cache": true,
@@ -42,10 +47,5 @@
   "yaml.completion": true,
   "yaml.customTags": ["!encrypted/pkcs1-oaep scalar", "!vault scalar"],
   "yaml.format.enable": false,
-  "yaml.validate": true,
-  "evenBetterToml.formatter.alignComments": false,
-  "evenBetterToml.formatter.arrayTrailingComma": true,
-  "[toml]": {
-    "editor.defaultFormatter": "panekj.even-betterer-toml"
-  }
+  "yaml.validate": true
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/mkdocs.yml 
new/ansible-compat-25.1.2/mkdocs.yml
--- old/ansible-compat-25.1.1/mkdocs.yml        2025-01-28 15:14:46.000000000 
+0100
+++ new/ansible-compat-25.1.2/mkdocs.yml        2025-02-05 11:04:35.000000000 
+0100
@@ -41,11 +41,11 @@
   - mkdocstrings:
       handlers:
         python:
-          import:
+          inventories:
             - https://docs.python.org/3/objects.inv
           options:
             # heading_level: 2
-            docstring_style: sphinx
+            docstring_style: google
             docstring_options:
               ignore_init_summary: yes
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/readthedocs.yml 
new/ansible-compat-25.1.2/readthedocs.yml
--- old/ansible-compat-25.1.1/readthedocs.yml   2025-01-28 15:14:46.000000000 
+0100
+++ new/ansible-compat-25.1.2/readthedocs.yml   1970-01-01 01:00:00.000000000 
+0100
@@ -1,25 +0,0 @@
-version: 2
-
-submodules:
-  include: all
-  recursive: true
-
-mkdocs:
-  fail_on_warning: true
-  configuration: mkdocs.yml
-
-build:
-  os: ubuntu-24.04
-  tools:
-    python: "3.11"
-  commands:
-    - pip install --user tox
-    - python3 -m tox -e docs
-python:
-  install:
-    - method: pip
-      path: tox
-    - method: pip
-      path: .
-      extra_requirements:
-        - docs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/src/ansible_compat/prerun.py 
new/ansible-compat-25.1.2/src/ansible_compat/prerun.py
--- old/ansible-compat-25.1.1/src/ansible_compat/prerun.py      2025-01-28 
15:14:46.000000000 +0100
+++ new/ansible-compat-25.1.2/src/ansible_compat/prerun.py      2025-02-05 
11:04:35.000000000 +0100
@@ -3,9 +3,26 @@
 import hashlib
 import os
 import tempfile
+import warnings
 from pathlib import Path
 
 
+def is_writable(path: Path) -> bool:
+    """Check if path is writable, creating if necessary.
+
+    Args:
+        path: Path to check.
+
+    Returns:
+        True if path is writable, False otherwise.
+    """
+    try:
+        path.mkdir(parents=True, exist_ok=True)
+    except OSError:
+        return False
+    return path.exists() and os.access(path, os.W_OK)
+
+
 def get_cache_dir(project_dir: Path, *, isolated: bool = True) -> Path:
     """Compute cache directory to be used based on project path.
 
@@ -14,31 +31,51 @@
         isolated: Whether to use isolated cache directory.
 
     Returns:
-        Cache directory path.
+        A writable cache directory.
 
     Raises:
         RuntimeError: if cache directory is not writable.
+        OSError: if cache directory cannot be created.
     """
-    cache_dir = Path(os.environ.get("ANSIBLE_HOME", "~/.ansible")).expanduser()
-
+    cache_dir: Path | None = None
     if "VIRTUAL_ENV" in os.environ:
-        path = Path(os.environ["VIRTUAL_ENV"])
-        if not path.exists():  # pragma: no cover
-            msg = f"VIRTUAL_ENV={os.environ['VIRTUAL_ENV']} does not exist."
-            raise RuntimeError(msg)
-        cache_dir = path.resolve() / ".ansible"
-    elif isolated:
-        if not project_dir.exists() or not os.access(project_dir, os.W_OK):
-            # As "project_dir" can also be "/" and user might not be able
-            # to write to it, we use a temporary directory as fallback.
-            checksum = hashlib.sha256(
-                project_dir.as_posix().encode("utf-8"),
-            ).hexdigest()[:4]
-
-            cache_dir = Path(tempfile.gettempdir()) / f".ansible-{checksum}"
-            cache_dir.mkdir(parents=True, exist_ok=True)
+        path = Path(os.environ["VIRTUAL_ENV"]).resolve() / ".ansible"
+        if is_writable(path):
+            cache_dir = path
+        else:
+            msg = f"Found VIRTUAL_ENV={os.environ['VIRTUAL_ENV']} but we 
cannot use it for caching as it is not writable."
+            warnings.warn(
+                message=msg,
+                stacklevel=2,
+                source={"msg": msg},
+            )
+
+    if isolated:
+        project_dir = project_dir.resolve() / ".ansible"
+        if is_writable(project_dir):
+            cache_dir = project_dir
         else:
-            cache_dir = project_dir.resolve() / ".ansible"
+            msg = f"Project directory {project_dir} cannot be used for caching 
as it is not writable."
+            warnings.warn(msg, stacklevel=2)
+    else:
+        cache_dir = Path(os.environ.get("ANSIBLE_HOME", 
"~/.ansible")).expanduser()
+        # This code should be never be reached because import from ansible-core
+        #  would trigger a fatal error if this location is not writable.
+        if not is_writable(cache_dir):  # pragma: no cover
+            msg = f"Cache directory {cache_dir} is not writable."
+            raise OSError(msg)
+
+    if not cache_dir:
+        # As "project_dir" can also be "/" and user might not be able
+        # to write to it, we use a temporary directory as fallback.
+        checksum = hashlib.sha256(
+            project_dir.as_posix().encode("utf-8"),
+        ).hexdigest()[:4]
+
+        cache_dir = Path(tempfile.gettempdir()) / f".ansible-{checksum}"
+        cache_dir.mkdir(parents=True, exist_ok=True)
+        msg = f"Using unique temporary directory {cache_dir} for caching."
+        warnings.warn(msg, stacklevel=2)
 
     # Ensure basic folder structure exists so `ansible-galaxy list` does not
     # fail with: None of the provided paths were usable. Please specify a 
valid path with
@@ -49,4 +86,5 @@
         msg = "Failed to create cache directory."
         raise RuntimeError(msg) from exc
 
+    # We succeed only if the path is writable.
     return cache_dir
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/src/ansible_compat/runtime.py 
new/ansible-compat-25.1.2/src/ansible_compat/runtime.py
--- old/ansible-compat-25.1.1/src/ansible_compat/runtime.py     2025-01-28 
15:14:46.000000000 +0100
+++ new/ansible-compat-25.1.2/src/ansible_compat/runtime.py     2025-02-05 
11:04:35.000000000 +0100
@@ -292,7 +292,7 @@
 
             if collections_paths != self.config.collections_paths:
                 _logger.info(
-                    "Collection paths was patch to include extra directories 
%s",
+                    "Collection paths was patched to include extra directories 
%s",
                     ",".join(collections_paths),
                 )
         else:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/src/ansible_compat/schema.py 
new/ansible-compat-25.1.2/src/ansible_compat/schema.py
--- old/ansible-compat-25.1.1/src/ansible_compat/schema.py      2025-01-28 
15:14:46.000000000 +0100
+++ new/ansible-compat-25.1.2/src/ansible_compat/schema.py      2025-02-05 
11:04:35.000000000 +0100
@@ -81,7 +81,7 @@
         Any errors encountered
 
     Raises:
-        SchemaError if the schema is invalid
+        jsonschema.SchemaError: if the schema is invalid
     """
     errors: list[JsonSchemaError] = []
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/test/test_prerun.py 
new/ansible-compat-25.1.2/test/test_prerun.py
--- old/ansible-compat-25.1.1/test/test_prerun.py       2025-01-28 
15:14:46.000000000 +0100
+++ new/ansible-compat-25.1.2/test/test_prerun.py       2025-02-05 
11:04:35.000000000 +0100
@@ -6,6 +6,8 @@
 from pathlib import Path
 from typing import TYPE_CHECKING
 
+import pytest
+
 if TYPE_CHECKING:
     from _pytest.monkeypatch import MonkeyPatch
 
@@ -50,5 +52,41 @@
     """
     monkeypatch.delenv("VIRTUAL_ENV", raising=False)
     monkeypatch.delenv("ANSIBLE_HOME", raising=False)
-    cache_dir = get_cache_dir(Path("/"), isolated=True)
+    with (
+        pytest.warns(
+            UserWarning,
+            match=r"Project directory /.ansible cannot be used for caching as 
it is not writable.",
+        ),
+        pytest.warns(
+            UserWarning,
+            match=r"Using unique temporary directory .* for caching.",
+        ),
+    ):
+        cache_dir = get_cache_dir(Path("/"), isolated=True)
+    assert cache_dir.as_posix().startswith(tempfile.gettempdir())
+
+
+def test_get_cache_dir_venv_ro_project_ro(monkeypatch: MonkeyPatch) -> None:
+    """Test behaviors of get_cache_dir with read-only virtual environment and 
read only project directory.
+
+    Args:
+        monkeypatch: Pytest fixture for monkeypatching
+    """
+    monkeypatch.setenv("VIRTUAL_ENV", "/")
+    monkeypatch.delenv("ANSIBLE_HOME", raising=False)
+    with (
+        pytest.warns(
+            UserWarning,
+            match=r"Using unique temporary directory .* for caching.",
+        ),
+        pytest.warns(
+            UserWarning,
+            match=r"Found VIRTUAL_ENV=/ but we cannot use it for caching as it 
is not writable.",
+        ),
+        pytest.warns(
+            UserWarning,
+            match=r"Project directory .* cannot be used for caching as it is 
not writable.",
+        ),
+    ):
+        cache_dir = get_cache_dir(Path("/etc"), isolated=True)
     assert cache_dir.as_posix().startswith(tempfile.gettempdir())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ansible-compat-25.1.1/test/test_runtime.py 
new/ansible-compat-25.1.2/test/test_runtime.py
--- old/ansible-compat-25.1.1/test/test_runtime.py      2025-01-28 
15:14:46.000000000 +0100
+++ new/ansible-compat-25.1.2/test/test_runtime.py      2025-02-05 
11:04:35.000000000 +0100
@@ -13,7 +13,6 @@
 from typing import TYPE_CHECKING, Any
 
 import pytest
-from ansible.plugins.loader import module_loader
 from packaging.version import Version
 
 from ansible_compat.constants import INVALID_PREREQUISITES_RC
@@ -400,7 +399,7 @@
 
 
 def test_require_collection_wrong_version(runtime: Runtime) -> None:
-    """Tests behaviour of require_collection."""
+    """Tests behavior of require_collection."""
     subprocess.check_output(
         [
             "ansible-galaxy",
@@ -472,7 +471,7 @@
     install: bool,
     runtime: Runtime,
 ) -> None:
-    """Tests behaviour of require_collection, missing case."""
+    """Tests behavior of require_collection, missing case."""
     with pytest.raises(AnsibleCompatError) as pytest_wrapped_e:
         runtime.require_collection(name=name, version=version, install=install)
     assert pytest_wrapped_e.type == InvalidPrerequisiteError
@@ -637,7 +636,7 @@
     # ensure that we inject our tmp folders in ansible paths
     runtime_tmp.prepare_environment()
 
-    # we install specific oudated version of a collection
+    # we install specific outdated version of a collection
     
runtime_tmp.install_collection("examples/reqs_v2/community-molecule-0.1.0.tar.gz")
     with pytest.raises(
         InvalidPrerequisiteError,
@@ -758,19 +757,11 @@
 ) -> None:
     """Tests ability to load plugin from a collection installed by 
requirement."""
     with cwd(Path(path)):
-        from ansible_compat.prerun import get_cache_dir
-
-        rmtree(get_cache_dir(Path.cwd()), ignore_errors=True)
         runtime = Runtime(isolated=True, require_module=True)
         runtime.prepare_environment(install_local=True)
         for plugin_name in expected_plugins:
-            loaded_module = module_loader.find_plugin_with_context(
-                plugin_name,
-                ignore_deprecated=True,
-                check_aliases=True,
-            )
             assert (
-                loaded_module.resolved_fqcn is not None
+                plugin_name in runtime.plugins.module
             ), f"Unable to load module {plugin_name}"
 
         runtime.clean()

Reply via email to