Skip to content

Commit

Permalink
Simplify module presence testing (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Feb 3, 2025
1 parent edc4d3f commit cab79c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,4 @@ ansible_collections
src/ansible_compat/_version.py
node_modules
_readthedocs
test/roles/acme.missing_deps/.ansible
11 changes: 1 addition & 10 deletions test/test_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -758,19 +757,11 @@ def test_load_plugins(
) -> 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()
Expand Down

0 comments on commit cab79c9

Please sign in to comment.