summaryrefslogtreecommitdiff
path: root/test/lib/ansible_test/_internal/provider/layout/ansible.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/ansible.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/ansible.py')
-rw-r--r--test/lib/ansible_test/_internal/provider/layout/ansible.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lib/ansible_test/_internal/provider/layout/ansible.py b/test/lib/ansible_test/_internal/provider/layout/ansible.py
index d2f8cc818a..3ee818a5b5 100644
--- a/test/lib/ansible_test/_internal/provider/layout/ansible.py
+++ b/test/lib/ansible_test/_internal/provider/layout/ansible.py
@@ -8,6 +8,11 @@ from . import (
LayoutProvider,
)
+from ...util import (
+ ANSIBLE_SOURCE_ROOT,
+ ANSIBLE_TEST_ROOT,
+)
+
class AnsibleLayout(LayoutProvider):
"""Layout provider for Ansible source."""
@@ -26,6 +31,15 @@ class AnsibleLayout(LayoutProvider):
module_utils='lib/ansible/module_utils',
)
+ errors: list[str] = []
+
+ if root != ANSIBLE_SOURCE_ROOT:
+ errors.extend((
+ f'Cannot test "{root}" with ansible-test from "{ANSIBLE_TEST_ROOT}".',
+ '',
+ f'Did you intend to run "{root}/bin/ansible-test" instead?',
+ ))
+
return ContentLayout(
root,
paths,
@@ -43,4 +57,5 @@ class AnsibleLayout(LayoutProvider):
unit_module_path='test/units/modules',
unit_module_utils_path='test/units/module_utils',
unit_messages=None,
+ unsupported=errors,
)