system-config/tox.ini
Ian Wienand 0d004ea73d testinfra: pass inventory and zuul data
Create a zuul_data fixture for testinfra.

The fixture directly loads the inventory from the inventory YAML file
written out.  This lets you get easy access to the IP addresses of the
hosts.

We pass in the "zuul" variable by writing it out to a YAML file on
disk, and then passing an environment variable to this.  This is
useful for things like determining which job is running.  Additional
arbitrary data could be added to this if required.

Change-Id: I8adb7601f7eec6d48509f8f1a42840beca70120c
2020-05-20 13:41:04 +10:00

45 lines
1.4 KiB
INI

[tox]
minversion = 1.6
envlist = linters
skipsdist = True
[testenv]
basepython = python3
usedevelop = True
install_command = pip install {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt
[testenv:linters]
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/openstack.yaml
# parses, but doesn't do anything.
bash -c "ANSIBLE_INVENTORY_PLUGINS=./playbooks/roles/install-ansible/files/inventory_plugins ansible -i ./inventory/openstack.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:venv]
commands = {posargs}
[testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -E -b html doc/source doc/build/html
[testenv:testinfra]
passenv =
TESTINFRA_EXTRA_DATA
commands = py.test --junit-xml junit.xml --connection=ansible --ansible-inventory=/etc/ansible/hosts/inventory.yaml -v testinfra {posargs}
[flake8]
show-source = True
exclude = .tox,.eggs
ignore = E125,H
select = H231