[stable-2.14] ansible-test - Update source layout detection (#81418) (#81435)

(cherry picked from commit c525514994)
pull/81458/head
Matt Clay 1 year ago committed by GitHub
parent 33f8460a78
commit 470be95257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- ansible-test - Update the logic used to detect when ``ansible-test`` is running from source.

@ -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

@ -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."""

Loading…
Cancel
Save