[tox] minversion = 3.2.0 envlist = linters,docs,py skipsdist = True requires = tox-ansible >= 1.4.0 # Automatic envs (pyXX) will only use the python version appropriate to that # env and ignore basepython inherited from [testenv] if we set # ignore_basepython_conflict. ignore_basepython_conflict = True [testenv] usedevelop = True passenv = TERM setenv = ANSIBLE_CALLBACK_PLUGINS={toxinidir}/validations_common/callback_plugins ANSIBLE_LOOKUP_PLUGINS={toxinidir}/validations_common/lookup_plugins ANSIBLE_LIBRARY={toxinidir}/validations_common/library ANSIBLE_ROLES_PATH={toxinidir}/validations_common/roles ANSIBLE_NOCOWS=1 ANSIBLE_RETRY_FILES_ENABLED=0 ANSIBLE_STDOUT_CALLBACK=debug ANSIBLE_LOG_PATH={envlogdir}/ansible-execution.log # 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 VIRTUAL_ENV={envdir} LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 HOME={envdir} DISABLE_PIP_VERSION_CHECK=1 commands = ansible-galaxy install -fr {toxinidir}/ansible-collections-requirements.yml stestr run --slowest --color {posargs} deps = -r {toxinidir}/requirements.txt -r {toxinidir}/test-requirements.txt -r {toxinidir}/doc/requirements.txt ansible-core<2.12 # GPLv3+ whitelist_externals = bash ansible-galaxy [testenv:py27] envtmpdir={envdir}/tmp skip_install = true commands_pre = cp -r {toxinidir}/validations_common {envtmpdir}/validations_common touch {envtmpdir}/validations_common/library/__init__.py find {envtmpdir}/validations_common/tests/ -type f -exec sed -i -e 's/from unittest import mock/import mock/g' \{\} ; find {envtmpdir}/validations_common/tests/ -type f -exec sed -i -e 's/from unittest.mock/from mock/g' \{\} ; find {envtmpdir} -type f -name 'setup.cfg' -exec sed -i -e 's/python-requires = >=3.6/python-requires = >=2.7/g' \{\} ; commands = python2.7 -m unittest discover -s {envtmpdir}/validations_common/tests deps = -c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/train} -r {toxinidir}/requirements.txt -r {toxinidir}/test-requirements.txt ansible-core<2.12 whitelist_externals = bash cp find sed touch [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:debug] commands = oslo_debug_helper {posargs} [testenv:pep8] envdir = {toxworkdir}/linters commands = python -m pre_commit run flake8 -a [testenv:ansible-lint] envdir = {toxworkdir}/linters deps = {[testenv:linters]deps} commands = bash -c "ANSIBLE_ROLES_PATH='{toxinidir}/validations_common/roles'" bash -c "ANSIBLE_LIBRARY='{toxinidir}/validations_common/library'" ansible-galaxy install -fr {toxinidir}/ansible-collections-requirements.yml 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 [testenv:linters] deps = -c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r {toxinidir}/requirements.txt -r {toxinidir}/test-requirements.txt ansible-core<2.12 # GPLv3+ commands = python '{toxinidir}/tools/validate-files.py' . {[testenv:ansible-lint]commands} {[testenv:yamllint]commands} {[testenv:bashate]commands} {[testenv:whitespace]commands} {[testenv:shebangs]commands} [testenv:releasenotes] deps = -r {toxinidir}/doc/requirements.txt commands = sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html [testenv:venv] commands = {posargs} passenv = * [testenv:cover] setenv = PYTHON=coverage run --parallel-mode --branch HOME={envdir} commands = coverage erase stestr run --color {posargs} coverage combine coverage html -d cover coverage xml -o cover/coverage.xml coverage report --show-missing [testenv:docs] deps = -c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r {toxinidir}/doc/requirements.txt commands= sphinx-build -a -E -W -d doc/build/doctrees --keep-going -b html doc/source doc/build/html -T doc8 doc [testenv:pdf-docs] whitelist_externals = make description = Build PDF documentation. envdir = {toxworkdir}/docs deps = {[testenv:docs]deps} commands = sphinx-build -b latex doc/source doc/build/pdf make -C doc/build/pdf [doc8] # Settings for doc8: extensions = .rst ignore = D001 [ansible] description = Used as base for all tox-ansible environments scenario_format = $parent-$nondefault_name molecule_opts = --debug