Relocate ansible-test code. (#60147)

* Initial move of `test/runner/` content.

`test/runner/lib/` -> `test/lib/ansible_test/_internal/`
`test/runner/`     -> `test/lib/ansible_test/_internal/data/`

* Initial move of `test/sanity/` content.

`test/sanity/` -> `test/lib/ansible_test/_internal/data/sanity/` (except `test/sanity/ignore.txt`)

* Initial move of `test/units/pytest/` content.

`test/units/pytest/` -> `test/lib/ansible_test/_internal/data/pytest/`

* Follow-up move of `test/runner/unit/` content.

`test/lib/ansible_test/_internal/data/unit/` -> `test/lib/ansible_test/tests/unit/`

* Initial move of `ansible.cfg` content.

`test/units/ansible.cfg` -> `test/lib/ansible_test/_internal/data/units/ansible.cfg`
`test/env/ansible.cfg` -> `test/lib/ansible_test/_internal/data/env/ansible.cfg`

* Follow-up move of `data` directory.

`test/lib/ansible_test/_internal/data/` -> `test/lib/ansible_test/_data/`

* Update import statements.

* Add missing __init__.py for unit tests.

* Fix path references and miscellaneous issues.
pull/60169/head
Matt Clay 5 years ago committed by GitHub
parent 923e21836b
commit d651bda123
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1464,16 +1464,16 @@ files:
docs/docsite/rst/user_guide/windows: *windows_core docs/docsite/rst/user_guide/windows: *windows_core
############################### ###############################
# 'test' is a component path, then 'test' label will be automatically added # 'test' is a component path, then 'test' label will be automatically added
test/sanity/validate-modules: test/lib/ansible_test/_data/sanity/validate-modules:
notified: notified:
- mattclay - mattclay
keywords: keywords:
- validate-modules - validate-modules
test/sanity/validate-modules/schema.py: test/lib/ansible_test/_data/sanity/validate-modules/schema.py:
notified: notified:
- gundalow - gundalow
- sivel - sivel
test/sanity/validate-modules/main.py: test/lib/ansible_test/_data/sanity/validate-modules/main.py:
notified: notified:
- gundalow - gundalow
- sivel - sivel
@ -1520,9 +1520,9 @@ files:
test/integration/targets/vultr: *vultr test/integration/targets/vultr: *vultr
test/legacy/: test/legacy/:
notified: mattclay notified: mattclay
test/runner/: test/lib/:
notified: mattclay notified: mattclay
test/runner/lib/cloud/acme.py: *crypto test/lib/ansible_test/_internal/cloud/acme.py: *crypto
test/sanity/: test/sanity/:
notified: mattclay notified: mattclay
test/units/module_utils/docker/: test/units/module_utils/docker/:

@ -23,6 +23,6 @@ include MANIFEST.in
include changelogs/CHANGELOG*.rst include changelogs/CHANGELOG*.rst
include contrib/README.md include contrib/README.md
recursive-include contrib/inventory * recursive-include contrib/inventory *
exclude test/sanity/code-smell/botmeta.* exclude test/lib/ansible_test/_data/sanity/code-smell/botmeta.*
recursive-include hacking/build_library *.py recursive-include hacking/build_library *.py
include hacking/build-ansible.py include hacking/build-ansible.py

@ -1,15 +1,21 @@
#!/usr/bin/env python #!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK # PYTHON_ARGCOMPLETE_OK
"""Primary entry point for ansible-test.""" """Command line entry point for ansible-test."""
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import os import os
import sys import sys
if __name__ == '__main__': if __name__ == '__main__':
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'test', 'runner'))) ansible_root = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__))))
import lib.cli source_root = os.path.join(ansible_root, 'test', 'lib')
lib.cli.main()
if os.path.exists(os.path.join(ansible_root, 'setup.py')) and os.path.exists(os.path.join(source_root, 'ansible_test', '_internal', 'cli.py')):
# running from source, use that version of ansible-test instead of any version that may already be installed
sys.path.insert(0, source_root)
from ansible_test._internal.cli import main
main()

@ -15,7 +15,7 @@ This test can error in the following ways:
added, this error should go away. added, this error should go away.
* A file has a _BUNDLED_METADATA variable but the file isn't specified in * A file has a _BUNDLED_METADATA variable but the file isn't specified in
:file:`test/sanity/code-smell/update-bundled.py`. This typically happens when a new bundled :file:`test/lib/ansible_test/_data/sanity/code-smell/update-bundled.py`. This typically happens when a new bundled
library is added. Add the file to the `get_bundled_libs()` function in the `update-bundled.py` library is added. Add the file to the `get_bundled_libs()` function in the `update-bundled.py`
test script to solve this error. test script to solve this error.

@ -52,7 +52,7 @@ Help
Extending validate-modules Extending validate-modules
========================== ==========================
The ``validate-modules`` tool has a `schema.py <https://github.com/ansible/ansible/blob/devel/test/sanity/validate-modules/schema.py>`_ that is used to validate the YAML blocks, such as ``DOCUMENTATION`` and ``RETURNS``. The ``validate-modules`` tool has a `schema.py <https://github.com/ansible/ansible/blob/devel/test/lib/ansible_test/_data/sanity/validate-modules/schema.py>`_ that is used to validate the YAML blocks, such as ``DOCUMENTATION`` and ``RETURNS``.
Codes Codes

@ -13,7 +13,7 @@ import sys
DATABASE_PATH = os.path.expanduser('~/.ansible/report.db') DATABASE_PATH = os.path.expanduser('~/.ansible/report.db')
BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) + '/' BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) + '/'
ANSIBLE_PATH = os.path.join(BASE_PATH, 'lib') ANSIBLE_PATH = os.path.join(BASE_PATH, 'lib')
ANSIBLE_TEST_PATH = os.path.join(BASE_PATH, 'test/runner') ANSIBLE_TEST_PATH = os.path.join(BASE_PATH, 'test/lib')
if ANSIBLE_PATH not in sys.path: if ANSIBLE_PATH not in sys.path:
sys.path.insert(0, ANSIBLE_PATH) sys.path.insert(0, ANSIBLE_PATH)
@ -24,7 +24,7 @@ if ANSIBLE_TEST_PATH not in sys.path:
from ansible.module_utils.urls import open_url from ansible.module_utils.urls import open_url
from ansible.parsing.metadata import extract_metadata from ansible.parsing.metadata import extract_metadata
from lib.target import walk_integration_targets from ansible_test._internal.target import walk_integration_targets
def main(): def main():

@ -1,4 +1,4 @@
shippable/posix/group2 shippable/posix/group2
destructive destructive
needs/target/setup_openssl needs/target/setup_openssl
needs/file/test/runner/requirements/constraints.txt needs/file/test/lib/ansible_test/_data/requirements/constraints.txt

@ -17,4 +17,4 @@
- name: 'Install hvac Python package' - name: 'Install hvac Python package'
pip: pip:
name: "{{ hvac_package|default('hvac') }}" name: "{{ hvac_package|default('hvac') }}"
extra_args: "-c {{ playbook_dir }}/../../../../runner/requirements/constraints.txt" extra_args: "-c {{ playbook_dir }}/../../../../lib/ansible_test/_data/requirements/constraints.txt"

@ -1 +1 @@
needs/file/test/runner/requirements/constraints.txt needs/file/test/lib/ansible_test/_data/requirements/constraints.txt

@ -4,5 +4,5 @@
- name: copy constraints.txt to remote host - name: copy constraints.txt to remote host
copy: copy:
src: "{{ role_path }}/../../../runner/requirements/constraints.txt" src: "{{ role_path }}/../../../lib/ansible_test/_data/requirements/constraints.txt"
dest: "{{ remote_constraints }}" dest: "{{ remote_constraints }}"

@ -9,7 +9,7 @@ import os
def main(): def main():
src = 'packaging/requirements/requirements-azure.txt' src = 'packaging/requirements/requirements-azure.txt'
dst = 'test/runner/requirements/integration.cloud.azure.txt' dst = 'test/lib/ansible_test/_data/requirements/integration.cloud.azure.txt'
missing = [p for p in [src, dst] if not os.path.isfile(p)] missing = [p for p in [src, dst] if not os.path.isfile(p)]

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save