summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2023-08-03 15:25:08 -0700
committerGitHub <noreply@github.com>2023-08-03 17:25:08 -0500
commit470be952570c19d03ada9877c30b26912fcc3b0e (patch)
tree87c32b1c9620df67e078528e4d3103774f0651b9
parent33f8460a78333824ede22e5c79829daddb4f3eae (diff)
downloadansible-470be952570c19d03ada9877c30b26912fcc3b0e.zip
[stable-2.14] ansible-test - Update source layout detection (#81418) (#81435)
(cherry picked from commit c52551499486009afdd91b301d7c5f711093369d)
-rw-r--r--changelogs/fragments/ansible-test-layout-detection.yml2
-rw-r--r--test/lib/ansible_test/_internal/ansible_util.py2
-rw-r--r--test/lib/ansible_test/_internal/provider/layout/ansible.py2
3 files changed, 4 insertions, 2 deletions
diff --git a/changelogs/fragments/ansible-test-layout-detection.yml b/changelogs/fragments/ansible-test-layout-detection.yml
new file mode 100644
index 0000000000..946853db94
--- /dev/null
+++ b/changelogs/fragments/ansible-test-layout-detection.yml
@@ -0,0 +1,2 @@
+minor_changes:
+ - ansible-test - Update the logic used to detect when ``ansible-test`` is running from source.
diff --git a/test/lib/ansible_test/_internal/ansible_util.py b/test/lib/ansible_test/_internal/ansible_util.py
index 9548d37c79..be88ccd875 100644
--- a/test/lib/ansible_test/_internal/ansible_util.py
+++ b/test/lib/ansible_test/_internal/ansible_util.py
@@ -231,7 +231,7 @@ def generate_egg_info(path: str) -> None:
# minimal PKG-INFO stub following the format defined in PEP 241
# required for older setuptools versions to avoid a traceback when importing pkg_resources from packages like cryptography
# newer setuptools versions are happy with an empty directory
- # including a stub here means we don't need to locate the existing file or have setup.py generate it when running from source
+ # including a stub here means we don't need to locate the existing file or run any tools to generate it when running from source
pkg_info = '''
Metadata-Version: 1.0
Name: ansible
diff --git a/test/lib/ansible_test/_internal/provider/layout/ansible.py b/test/lib/ansible_test/_internal/provider/layout/ansible.py
index 3ee818a5b5..3fad835a39 100644
--- a/test/lib/ansible_test/_internal/provider/layout/ansible.py
+++ b/test/lib/ansible_test/_internal/provider/layout/ansible.py
@@ -20,7 +20,7 @@ class AnsibleLayout(LayoutProvider):
@staticmethod
def is_content_root(path: str) -> bool:
"""Return True if the given path is a content root for this provider."""
- return os.path.exists(os.path.join(path, 'setup.py')) and os.path.exists(os.path.join(path, 'bin/ansible-test'))
+ return os.path.isfile(os.path.join(path, 'pyproject.toml')) and os.path.isdir(os.path.join(path, 'test/lib/ansible_test'))
def create(self, root: str, paths: list[str]) -> ContentLayout:
"""Create a Layout using the given root and paths."""