openstack-ansible-tests/tox.ini
Jesse Pretorius 0a4ac2a1c7 Have run_tests clone the test repo
Current run_tests.sh executes another script (tests-repo-clone.sh)
to clone the tests repo. That script therefore has to be replicated
out to all the other repositories too.

In order to try to reduce the footprint of things that need to be
replicated out to the repositories, we fold the tests repo clone
into run_tests.sh and move the clone of the previous tests repo
into the common test script. We also remove the conditional for
the previous test repo clone as it does no harm to always have it.

To reduce the maintenance when creating new branches, we key the
branch to be cloned by run_tests.sh to the content in the .gitreview
file. This way as soon as a branch is created and that file is
updated, the right branch is cloned and the system becomes self
maintaining.

Some extra comments are added to explain the purpose of variables/
commands and the install_pkg_deps function is changed to just be
in line script as the function is no re-used anywhere else.

We change the set vars in the common script to add x and remove v
to reduce the output verbosity and only output the useful stuff.

Finally, the linters job definition is changed so that it uses
run_tests.sh to execute the lint tests. This simplifies the job
definition and also ensures that zuul runs tests in the same way
that humans do.

Change-Id: I9f26f4f438715ce6361cc9960f58f2d256c5a839
2018-03-26 18:18:05 +01:00

119 lines
2.7 KiB
INI

[tox]
minversion = 2.0
skipsdist = True
envlist = docs,linters,func
[testenv]
usedevelop = True
install_command =
pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
deps =
-r{toxinidir}/test-requirements.txt
commands =
/usr/bin/find . -type f -name "*.pyc" -delete
passenv =
HOME
USER
http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
whitelist_externals =
bash
setenv =
PYTHONUNBUFFERED=1
VIRTUAL_ENV={envdir}
WORKING_DIR={toxinidir}
[testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt
commands=
bash -c "rm -rf doc/build"
doc8 doc
sphinx-build -b html doc/source doc/build/html
[doc8]
# Settings for doc8:
extensions = .rst
[testenv:releasenotes]
deps = -r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
# environment used by the -infra templated docs job
[testenv:venv]
commands =
{posargs}
[testenv:pep8]
commands =
bash -c "{toxinidir}/tests/common/test-pep8.sh"
[flake8]
# Ignores the following rules due to how ansible modules work in general
# F403 'from ansible.module_utils.basic import *' used;
# unable to detect undefined names
ignore=F403
[testenv:bashate]
commands =
bash -c "{toxinidir}/tests/common/test-bashate.sh"
# The deps URL should be set to the appropriate git URL.
# In the tests repo itself, the variable is uniquely set to
# the toxinidir so that the role is able to test itself, but
# the tox config is exactly the same as other repositories.
#
# The value for other repositories must be:
# http://git.openstack.org/cgit/openstack/openstack-ansible-tests/plain/test-ansible-deps.txt
# or for a stable branch:
# http://git.openstack.org/cgit/openstack/openstack-ansible-tests/plain/test-ansible-deps.txt?h=stable/newton
[testenv:ansible]
deps =
{[testenv]deps}
-rhttps://git.openstack.org/cgit/openstack/openstack-ansible/plain/global-requirement-pins.txt
-r{toxinidir}/test-ansible-deps.txt
[testenv:ansible-syntax]
deps =
{[testenv:ansible]deps}
commands =
bash -c "{toxinidir}/tests/common/test-ansible-syntax.sh"
[testenv:ansible-lint]
deps =
{[testenv:ansible]deps}
commands =
bash -c "{toxinidir}/tests/common/test-ansible-lint.sh"
[testenv:functional]
deps =
{[testenv:ansible]deps}
commands =
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
[testenv:linters]
deps =
{[testenv:ansible]deps}
commands =
{[testenv:pep8]commands}
{[testenv:bashate]commands}
{[testenv:ansible-lint]commands}
{[testenv:ansible-syntax]commands}