summaryrefslogtreecommitdiff
path: root/test/lib/ansible_test/_internal/provider/layout/collection.py
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2023-05-17 09:07:04 -0700
committerGitHub <noreply@github.com>2023-05-17 09:07:04 -0700
commitb16041f1a91bb74b7adbf2ad1f1af25603151cb3 (patch)
treef580eaa484288d8b095f3fd1e87d68f61b62fa14 /test/lib/ansible_test/_internal/provider/layout/collection.py
parent2fd64161c1ae4a8930e9b6094804ac9976a9f2ad (diff)
downloadansible-b16041f1a91bb74b7adbf2ad1f1af25603151cb3.tar.gz
ansible-test - Fix traceback when mixing sources (#80801)
* ansible-test - Fix traceback when mixing sources * ansible-test - Refactor layout error handling
Diffstat (limited to 'test/lib/ansible_test/_internal/provider/layout/collection.py')
-rw-r--r--test/lib/ansible_test/_internal/provider/layout/collection.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/lib/ansible_test/_internal/provider/layout/collection.py b/test/lib/ansible_test/_internal/provider/layout/collection.py
index d747f31f31..a9221be6f3 100644
--- a/test/lib/ansible_test/_internal/provider/layout/collection.py
+++ b/test/lib/ansible_test/_internal/provider/layout/collection.py
@@ -53,6 +53,14 @@ class CollectionLayout(LayoutProvider):
integration_targets_path = self.__check_integration_path(paths, integration_messages)
self.__check_unit_path(paths, unit_messages)
+ errors: list[str] = []
+
+ if not is_valid_identifier(collection_namespace):
+ errors.append(f'The namespace "{collection_namespace}" is an invalid identifier or a reserved keyword.')
+
+ if not is_valid_identifier(collection_name):
+ errors.append(f'The name "{collection_name}" is an invalid identifier or a reserved keyword.')
+
return ContentLayout(
root,
paths,
@@ -74,7 +82,7 @@ class CollectionLayout(LayoutProvider):
unit_module_path='tests/unit/plugins/modules',
unit_module_utils_path='tests/unit/plugins/module_utils',
unit_messages=unit_messages,
- unsupported=not (is_valid_identifier(collection_namespace) and is_valid_identifier(collection_name)),
+ unsupported=errors,
)
@staticmethod