summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2023-05-16 17:43:40 -0700
committerGitHub <noreply@github.com>2023-05-16 17:43:40 -0700
commit96127a15f31ee64a38d6b185b9b9bd9db7965b78 (patch)
treea254d5957f838052588a2848e5e30539cb657f60
parent3b8d2cbd016a050fea34c43d820dcf72e6e4ff34 (diff)
downloadansible-stable-2.15.tar.gz
[stable-2.15] Use subset checks for some collection loader tests (#80812) (#80814)stable-2.15
(cherry picked from commit 2ba24957dd373ef191455b34058ba7f65705cfd3)
-rw-r--r--test/units/utils/collection_loader/test_collection_loader.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/units/utils/collection_loader/test_collection_loader.py b/test/units/utils/collection_loader/test_collection_loader.py
index a8a31a3b01..9be59307a9 100644
--- a/test/units/utils/collection_loader/test_collection_loader.py
+++ b/test/units/utils/collection_loader/test_collection_loader.py
@@ -865,8 +865,9 @@ def test_importlib_resources():
testns_paths.append(Path(path) / 'ansible_collections' / 'testns')
assert testns._paths == testns_paths
- assert ansible_ns._paths == ansible_ns_paths
- assert ansible_collections_ns._paths == [Path(p) / 'ansible_collections' for p in default_test_collection_paths[:2]]
+ # NOTE: The next two asserts check for subsets to accommodate running the unit tests when externally installed collections are available.
+ assert set(ansible_ns_paths).issubset(ansible_ns._paths)
+ assert set(Path(p) / 'ansible_collections' for p in default_test_collection_paths[:2]).issubset(ansible_collections_ns._paths)
assert testcoll2 == second_path / 'ansible_collections' / 'testns' / 'testcoll2'
assert {p.name for p in module_utils.glob('*.py')} == {'__init__.py', 'my_other_util.py', 'my_util.py'}