tripleo-repos/tox.ini

103 lines
2.6 KiB
INI

[tox]
minversion = 3.18.0
skipsdist = True
envlist = py,pep8,packaging,sanity
requires =
tox-ansible>=1.5.3
[testenv]
usedevelop = True
setenv =
ANSIBLE_FORCE_COLOR={tty:1:0}
VIRTUAL_ENV={envdir}
passenv =
HOME
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
commands =
stestr run --slowest {posargs}
[testenv:venv]
commands = {posargs}
[testenv:docs]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
allowlist_externals =
rm
commands =
rm -rf doc/build
sphinx-build -W --keep-going -b html doc/source doc/build/html
[testenv:pep8]
deps = flake8
commands = flake8
[testenv:cover]
setenv =
PYTHON=coverage run --source tripleo_repos --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:packaging]
description =
Build package, verify metadata, install package and assert basic behavior
deps =
build
twine
ansible-core # used for ansible-galaxy command
skip_install = true
commands =
# build wheel and sdist using PEP-517
{envpython} -c 'import os.path, shutil, sys; \
dist_dir = os.path.join("{toxinidir}", "dist"); \
os.path.isdir(dist_dir) or sys.exit(0); \
print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \
shutil.rmtree(dist_dir)'
{envpython} -m build \
--sdist \
--wheel \
--outdir {toxinidir}/dist/ \
{toxinidir}
# Validate metadata using twine
twine check {toxinidir}/dist/*
# Install the wheel
sh -c "python3 -m pip install {toxinidir}/dist/*.whl"
# Assure that CLIs were installed
tripleo-repos --help
tripleo-get-hash --help
tripleo-yum-config --help
# Validate collection installation
ansible-galaxy collection install --force .
# Ensure that ansible is able to load the modules, as syntax check will fail
# if modules cannot be loaded.
sh -c "ansible-playbook --syntax-check playbooks/*.yaml"
ansible localhost -m tripleo.repos.get_hash -a "release=master os_version=centos8"
allowlist_externals =
sh
[testenv:molecule]
description = Used by all molecule jobs (tox-ansible)
deps =
ansible-core
molecule>=3.3.0,<3.4.0 # bug with collection install
molecule-docker
usedevelop = False
skip_install = true
commands =
ansible-galaxy collection install -v 'community.docker:>=1.8.0'
ansible-galaxy collection install -v --force .
molecule test
[flake8]
ignore = H803
show-source = True
exclude = .tox,dist,doc,*.egg,build