Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ansible-test available in the bin directory. #45876

Merged
merged 2 commits into from
Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions bin/ansible-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Primary entry point for ansible-test."""

from __future__ import (absolute_import, division, print_function)

__metaclass__ = type

import os
import sys

if __name__ == '__main__':
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'test', 'runner')))
import lib.cli
lib.cli.main()
2 changes: 1 addition & 1 deletion hacking/env-setup
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ FULL_PATH=$($PYTHON_BIN -c "import os; print(os.path.realpath('$HACKING_DIR'))")
export ANSIBLE_HOME="$(dirname "$FULL_PATH")"

PREFIX_PYTHONPATH="$ANSIBLE_HOME/lib"
PREFIX_PATH="$ANSIBLE_HOME/bin:$ANSIBLE_HOME/test/runner"
PREFIX_PATH="$ANSIBLE_HOME/bin"
PREFIX_MANPATH="$ANSIBLE_HOME/docs/man"

expr "$PYTHONPATH" : "${PREFIX_PYTHONPATH}.*" > /dev/null || prepend_path PYTHONPATH "$PREFIX_PYTHONPATH"
Expand Down
2 changes: 1 addition & 1 deletion hacking/env-setup.fish
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set HACKING_DIR (dirname (status -f))
set FULL_PATH (python -c "import os; print(os.path.realpath('$HACKING_DIR'))")
set ANSIBLE_HOME (dirname $FULL_PATH)
set PREFIX_PYTHONPATH $ANSIBLE_HOME/lib
set PREFIX_PATH $ANSIBLE_HOME/bin $ANSIBLE_HOME/test/runner
set PREFIX_PATH $ANSIBLE_HOME/bin
set PREFIX_MANPATH $ANSIBLE_HOME/docs/man

# set quiet flag
Expand Down
1 change: 0 additions & 1 deletion test/runner/ansible-test

This file was deleted.

8 changes: 8 additions & 0 deletions test/runner/ansible-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Legacy entry point for ansible-test. The preferred version is in the bin directory."""

import lib.cli

if __name__ == '__main__':
lib.cli.main()
8 changes: 1 addition & 7 deletions test/runner/test.py → test/runner/lib/cli.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Test runner for all Ansible tests."""

from __future__ import absolute_import, print_function
Expand Down Expand Up @@ -72,7 +70,7 @@
def main():
"""Main program function."""
try:
git_root = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..'))
git_root = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..'))
os.chdir(git_root)
initialize_cloud_plugins()
sanity_init()
Expand Down Expand Up @@ -786,7 +784,3 @@ def complete_sanity_test(prefix, parsed_args, **_):
tests = sorted(t.name for t in sanity_get_tests())

return [i for i in tests if i.startswith(prefix)]


if __name__ == '__main__':
main()
6 changes: 3 additions & 3 deletions test/runner/lib/delegation.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def delegate_tox(args, exclude, require, integration_targets):

tox.append('--')

cmd = generate_command(args, os.path.abspath('test/runner/test.py'), options, exclude, require)
cmd = generate_command(args, os.path.abspath('bin/ansible-test'), options, exclude, require)

if not args.python:
cmd += ['--python', version]
Expand Down Expand Up @@ -195,7 +195,7 @@ def delegate_docker(args, exclude, require, integration_targets):
'--docker-util': 1,
}

cmd = generate_command(args, '/root/ansible/test/runner/test.py', options, exclude, require)
cmd = generate_command(args, '/root/ansible/bin/ansible-test', options, exclude, require)

if isinstance(args, TestConfig):
if args.coverage and not args.coverage_label:
Expand Down Expand Up @@ -364,7 +364,7 @@ def delegate_remote(args, exclude, require, integration_targets):
'--remote': 1,
}

cmd = generate_command(args, 'ansible/test/runner/test.py', options, exclude, require)
cmd = generate_command(args, 'ansible/bin/ansible-test', options, exclude, require)

if httptester_id:
cmd += ['--inject-httptester']
Expand Down
1 change: 0 additions & 1 deletion test/sanity/pylint/ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,5 @@ test/runner/lib/thread.py missing-docstring 3.7
test/runner/lib/util.py missing-docstring 3.7
test/runner/retry.py missing-docstring 3.7
test/runner/shippable.py missing-docstring 3.7
test/runner/test.py missing-docstring 3.7
test/runner/units/test_diff.py missing-docstring 3.7
test/sanity/import/importer.py missing-docstring 3.7