2018-07-17 16:28:20 -07:00
[tox]
2018-11-02 13:16:26 +07:00
minversion = 2.0
2018-07-17 16:28:20 -07:00
envlist = docs, linters
skipdist = True
[testenv]
usedevelop = True
2019-04-28 14:11:58 +08:00
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} {opts} {packages}
2019-06-05 08:24:43 -05:00
passenv = *
setenv =
VIRTUAL_ENV = {envdir}
2019-07-18 14:00:05 -04:00
ANSIBLE_ACTION_PLUGINS = {toxinidir}/tripleo_ansible/roles.galaxy/config_template/action:{toxinidir}/tripleo_ansible/ansible_plugins/action
2019-06-05 08:24:43 -05:00
ANSIBLE_CALLBACK_PLUGINS = {toxinidir}/tripleo_ansible/ansible_plugins/callback
ANSIBLE_FILTER_PLUGINS = {toxinidir}/tripleo_ansible/ansible_plugins/filter
2019-07-18 14:00:05 -04:00
ANSIBLE_LIBRARY = {toxinidir}/tripleo_ansible/roles.galaxy/config_template/library:{toxinidir}/tripleo_ansible/ansible_plugins/modules
2019-06-05 08:24:43 -05:00
ANSIBLE_MODULE_UTILS = {toxinidir}/tripleo_ansible/ansible_plugins/module_utils
2019-07-18 13:30:34 -05:00
ANSIBLE_ROLES_PATH = {toxinidir}/tripleo_ansible/roles.galaxy:{toxinidir}/tripleo_ansible/roles
2019-06-07 20:48:40 -05:00
ANSIBLE_INVENTORY = {toxinidir}/tests/hosts.ini
ANSIBLE_NOCOWS = 1
ANSIBLE_RETRY_FILES_ENABLED = 0
ANSIBLE_STDOUT_CALLBACK = debug
2019-06-20 14:10:52 -05:00
ANSIBLE_LOG_PATH = {envlogdir}/ansible-execution.log
2019-06-07 20:48:40 -05:00
VIRTUAL_ENV = {envdir}
# pip: Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207
# paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598
PYTHONWARNINGS = ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning
PIP_DISABLE_PIP_VERSION_CHECK = 1
2019-07-01 10:42:49 -05:00
sitepackages = True
2018-09-07 15:01:36 -04:00
deps = -r {toxinidir}/test-requirements.txt
2018-07-17 16:28:20 -07:00
whitelist_externals = bash
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files.
deps = bindep
commands = bindep test
[testenv:pep8]
2019-06-05 08:24:43 -05:00
envdir = {toxworkdir}/linters
2018-07-17 16:28:20 -07:00
commands =
2019-06-05 08:24:43 -05:00
python -m pre_commit run flake8 -a
2018-07-17 16:28:20 -07:00
[testenv:ansible-lint]
2019-06-05 08:24:43 -05:00
envdir = {toxworkdir}/linters
2019-06-27 17:09:39 -05:00
deps =
{[testenv:linters]deps}
2018-07-17 16:28:20 -07:00
commands =
2019-07-18 13:30:34 -05:00
bash -c "ANSIBLE_ROLES_PATH = '{toxinidir}/tripleo_ansible/roles.galaxy' \
ansible-galaxy install -fr {toxinidir}/tripleo_ansible/ansible-role-requirements.yml"
2019-06-05 08:24:43 -05:00
python -m pre_commit run ansible-lint -a
[testenv:yamllint]
envdir = {toxworkdir}/linters
deps = {[testenv:linters]deps}
commands =
python -m pre_commit run yamllint -a
[testenv:bashate]
envdir = {toxworkdir}/linters
deps = {[testenv:linters]deps}
commands =
python -m pre_commit run bashate -a
[testenv:whitespace]
envdir = {toxworkdir}/linters
deps = {[testenv:linters]deps}
commands =
python -m pre_commit run trailing-whitespace -a
[testenv:shebangs]
envdir = {toxworkdir}/linters
deps = {[testenv:linters]deps}
commands =
python -m pre_commit run check-executables-have-shebangs -a
2018-07-17 16:28:20 -07:00
[testenv:linters]
deps =
2019-06-05 08:24:43 -05:00
-r {toxinidir}/requirements.txt
2019-06-27 17:09:39 -05:00
-r {toxinidir}/test-requirements.txt
-r {toxinidir}/molecule-requirements.txt
2018-07-17 16:28:20 -07:00
commands =
{[testenv:pep8]commands}
2019-10-29 10:54:24 +00:00
{[testenv:ansible-lint]commands}
2019-06-05 08:24:43 -05:00
{[testenv:bashate]commands}
{[testenv:yamllint]commands}
{[testenv:whitespace]commands}
{[testenv:shebangs]commands}
2019-09-16 11:58:25 -05:00
bash -c '{toxinidir}/scripts/detect-broken-symlinks.sh'
2018-07-17 16:28:20 -07:00
[testenv:releasenotes]
2019-06-14 09:03:51 -05:00
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
2019-06-05 08:24:43 -05:00
commands =
2019-11-03 02:37:53 +08:00
sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html
2019-06-14 09:03:51 -05:00
[testenv:docs]
basepython = python3
2019-07-09 15:23:01 -05:00
deps =
2019-07-10 12:31:51 -05:00
-r {toxinidir}/doc/requirements.txt
2019-06-14 09:03:51 -05:00
commands =
doc8 doc
2019-11-03 02:37:53 +08:00
sphinx-build -a -E -W -d doc/build/doctrees --keep-going -b html doc/source doc/build/html -T
2019-06-14 09:03:51 -05:00
[doc8]
# Settings for doc8:
extensions = .rst
ignore = D001
2018-07-17 16:28:20 -07:00
[testenv:venv]
commands = {posargs}
2019-06-07 20:48:40 -05:00
2019-06-19 08:38:15 -05:00
[testenv:role-addition]
deps =
{[testenv:linters]deps}
commands =
bash -c "ansible-playbook -i localhost, role-addition.yml -e role_name = skeleton_test"
2019-07-02 14:27:03 -05:00
bash -c "if (podman ps 2> /dev/null || docker ps 2> /dev/null); then \
cd {toxinidir}/tripleo_ansible/roles/skeleton_test; \
molecule test --all; \
else \
echo -e '\n\nNo molecule tests have been executed\nSee https://docs.openstack.org/tripleo-ansible/latest/contributing.html#local-testing-of-new-roles\n\n'; \
fi"
2019-06-19 08:38:15 -05:00
{[testenv:linters]commands}
2019-11-02 12:13:27 +02:00
[testenv:modules]
deps =
{[testenv:linters]deps}
commands =
bash -c "cd {toxinidir}/tripleo_ansible/ansible_plugins/tests; molecule test --all;"
{[testenv:linters]commands}