system-config/tox.ini
Ian Wienand 001ad4d7b1 tox: drop test-requirements.txt
We have several tox environments that don't really share the same
dependencies.  Currently we put everything into test-requirements.txt,
meaning the linter environment gets testinfra and testinfra
environment gets things like ansible-lint it's not using.

Apart from being a bit faster not installing things, this is helpful
for restoring the ansible -devel test.  In that case, we have ansible
as a project dependency; when installing from git, ansible now
installs itself as "ansible-base" ("ansible" is the released pypi
package that incorporates collections).  So if we install ansible-lint
in the testinfra environment, this pulls in ansible ... and then it
breaks when tox wants to install our Zuul clone of upstream ansible
(you can't have ansible and ansible-base together).

Change-Id: I5f3fc93e6ddd611f319fa269e122ed576c9cb378
2020-08-25 08:41:44 +10:00

61 lines
1.9 KiB
INI

[tox]
minversion = 1.6
envlist = linters
skipsdist = True
[testenv]
basepython = python3
usedevelop = True
install_command = pip install {opts} {packages}
[testenv:linters]
deps =
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
bashate>=0.2 # Apache-2.0
PyYAML>=3.10.0 # MIT
ansible-lint>=4.1.0
openstacksdk
testtools
mock
whitelist_externals = bash
setenv =
ANSIBLE_LIBRARY= {toxinidir}/tools/fake-ansible/library
commands =
flake8
{toxinidir}/tools/run-bashate.sh
python3 {toxinidir}/tools/sorted_modules_env.py {toxinidir}/modules.env
python3 {toxinidir}/tools/irc_checks.py
python3 {toxinidir}/tools/check_clouds_yaml.py
# The following command validates that inventory/base/hosts.yaml
# parses, but doesn't do anything.
bash -c "ANSIBLE_INVENTORY_PLUGINS=./playbooks/roles/install-ansible/files/inventory_plugins ansible -i ./inventory/base/hosts.yaml not_a_host -a 'true'"
python3 -m unittest playbooks/roles/install-ansible/files/inventory_plugins/test_yamlgroup.py
bash -c "find roles playbooks -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 ansible-lint"
[testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -E -b html doc/source doc/build/html
[testenv:testinfra]
deps =
# testinfra 1.17.0 has a broken wheel that won't install under python3
# testinfra 3.0.0 switched the ansible backend, but broke ipv6 handling
testinfra!=1.17.0,!=3.0.0
ansible-base
pytest-html # MPL-2.0
# This environment assumes a gate-hosts.yaml file has been written.
passenv =
TESTINFRA_EXTRA_DATA
commands = py.test \
--junit-xml junit.xml -o junit_family=xunit1 \
--html=test-results.html --self-contained-html \
--connection=ansible \
--ansible-inventory=/home/zuul/src/opendev.org/opendev/system-config/inventory/base/gate-hosts.yaml -v testinfra {posargs}
[flake8]
show-source = True
exclude = .tox,.eggs
ignore = E125,H
select = H231