ansible-hardening/tox.ini
Dmitriy Rabotyagov e77c311442 Update tox.ini to work with 4.0
With tox release of 4.0, some parameters were deprecated and are ignored now
which causes tox failures. One of the most spread issues we have is using
`whitelist_externals` isntead of `allowlist_externals`


Change-Id: I7807b7d29f4504404253f5c42b624639c8b19c97
2022-12-27 17:53:11 +01:00

114 lines
2.5 KiB
INI

[tox]
minversion = 3.1
skipsdist = True
envlist = docs,linters,functional
ignore_basepython_conflict = True
[testenv]
basepython = python3
usedevelop = False
commands =
/usr/bin/find . -type f -name "*.pyc" -delete
passenv =
HOME
USER
http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
allowlist_externals =
bash
setenv =
PYTHONUNBUFFERED=1
ROLE_NAME=ansible-hardening
TEST_CHECK_MODE=true
TEST_IDEMPOTENCE=true
VIRTUAL_ENV={envdir}
WORKING_DIR={toxinidir}
[testenv:docs]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
-r{toxinidir}/doc/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
bash -c "rm -rf doc/build"
# NOTE(mhayden): doc8 really dislikes the automated docs. This should be
# enabled again later.
#doc8 doc
sphinx-build -W -b html doc/source doc/build/html
[testenv:pdf-docs]
deps = {[testenv:docs]deps}
allowlist_externals =
make
commands =
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[doc8]
# Settings for doc8:
extensions = .rst
allow-long-titles=1
[testenv:releasenotes]
deps = {[testenv:docs]deps}
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"
[testenv:ansible-syntax]
commands =
bash -c "{toxinidir}/tests/common/test-ansible-syntax.sh"
[testenv:ansible-lint]
commands =
bash -c "{toxinidir}/tests/common/test-ansible-lint.sh"
[testenv:functional]
setenv =
{[testenv]setenv}
# NOTE(mhayden): Disabling chrony since it causes conflicts in CI.
ANSIBLE_PARAMETERS=-e security_rhel7_enable_chrony=no
commands =
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
[testenv:linters]
commands =
bash -c "{toxinidir}/tests/common/test-ansible-env-prep.sh"
{[testenv:pep8]commands}
{[testenv:bashate]commands}
{[testenv:ansible-lint]commands}
{[testenv:ansible-syntax]commands}