Skip to content

Commit cab79c9

Browse files
authoredFeb 3, 2025··
Simplify module presence testing (#460)
1 parent edc4d3f commit cab79c9

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,4 @@ ansible_collections
136136
src/ansible_compat/_version.py
137137
node_modules
138138
_readthedocs
139+
test/roles/acme.missing_deps/.ansible

‎test/test_runtime.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from typing import TYPE_CHECKING, Any
1414

1515
import pytest
16-
from ansible.plugins.loader import module_loader
1716
from packaging.version import Version
1817

1918
from ansible_compat.constants import INVALID_PREREQUISITES_RC
@@ -758,19 +757,11 @@ def test_load_plugins(
758757
) -> None:
759758
"""Tests ability to load plugin from a collection installed by requirement."""
760759
with cwd(Path(path)):
761-
from ansible_compat.prerun import get_cache_dir
762-
763-
rmtree(get_cache_dir(Path.cwd()), ignore_errors=True)
764760
runtime = Runtime(isolated=True, require_module=True)
765761
runtime.prepare_environment(install_local=True)
766762
for plugin_name in expected_plugins:
767-
loaded_module = module_loader.find_plugin_with_context(
768-
plugin_name,
769-
ignore_deprecated=True,
770-
check_aliases=True,
771-
)
772763
assert (
773-
loaded_module.resolved_fqcn is not None
764+
plugin_name in runtime.plugins.module
774765
), f"Unable to load module {plugin_name}"
775766

776767
runtime.clean()

0 commit comments

Comments
 (0)
Please sign in to comment.