mirror of https://github.com/ansible/ansible.git
[stable-2.10] Fix ansible-test handling of egg-info. (#73595)
* Add test to verify pkg_resources imports work. (cherry picked from commitpull/73771/head133a29acb4
) * [stable-2.10] Fix ansible-test handling of egg-info. Resolves https://github.com/ansible/ansible/issues/67990. (cherry picked from commitd092356fc5
) Co-authored-by: Matt Clay <matt@mystile.com>
parent
a5f0bc0165
commit
b998f7050b
@ -0,0 +1,11 @@
|
||||
bugfixes:
|
||||
- ansible-test - Running tests using an installed version of ``ansible-test`` against one Python version from another no longer fails
|
||||
due to a missing ``egg-info`` directory.
|
||||
This could occur when testing plugins which import ``pkg_resources``.
|
||||
- ansible-test - Running tests using an installed version of ``ansible-test`` no longer generates an error attempting to create an ``egg-info`` directory
|
||||
when an existing one is not found in the expected location.
|
||||
This could occur if the existing ``egg-info`` directory included a Python version specifier in the name.
|
||||
minor_changes:
|
||||
- ansible-test - Generation of an ``egg-info`` directory, if needed, is now done after installing test dependencies and before running tests.
|
||||
When running from an installed version of ``ansible-test`` a temporary directory is used to avoid permissions issues.
|
||||
Previously it was done before installing test dependencies and adjacent to the installed directory.
|
@ -0,0 +1 @@
|
||||
shippable/posix/group1
|
@ -0,0 +1,23 @@
|
||||
"""
|
||||
This test case verifies that pkg_resources imports from ansible plugins are functional.
|
||||
|
||||
If pkg_resources is not installed this test will succeed.
|
||||
If pkg_resources is installed but is unable to function, this test will fail.
|
||||
|
||||
One known failure case this test can detect is when ansible declares a __requires__ and then tests are run without an egg-info directory.
|
||||
"""
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
try:
|
||||
from pkg_resources import Requirement
|
||||
except ImportError:
|
||||
Requirement = None
|
||||
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
|
||||
|
||||
class LookupModule(LookupBase):
|
||||
def run(self, terms, variables=None, **kwargs):
|
||||
return []
|
@ -0,0 +1,3 @@
|
||||
- name: Verify that pkg_resources imports are functional
|
||||
debug:
|
||||
msg: "{{ lookup('check_pkg_resources') }}"
|
Loading…
Reference in New Issue