tobiko/tox.ini

283 lines
6.8 KiB
INI

[tox]
envlist = bindep,linters,cover
minversion = 3.4.0
# --- unit test environments -------------------------------------------------
[base]
deps =
-c{env:UPPER_CONSTRAINTS_FILE}
-r{toxinidir}/requirements.txt
passenv =
PS1
TOBIKO_*
setenv =
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
PS1=[tobiko@{envname}] {env:PS1:}
PYTHON={env:PYTHON:python3}
PYTHONWARNINGS=ignore::Warning,{env:PYTHONWARNINGS:}
TOBIKO_PREVENT_CREATE={env:TOBIKO_PREVENT_CREATE:false}
VIRTUAL_ENV={envdir}
UPPER_CONSTRAINTS_FILE={env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
commands =
stestr run {posargs}
[testenv]
usedevelop = True
deps =
{[base]deps}
-r{toxinidir}/test-requirements.txt
passenv = {[base]passenv}
setenv =
{[base]setenv}
OS_TEST_PATH={toxinidir}/tobiko/tests/unit
commands = {[base]commands}
[testenv:cover]
basepython = python3
setenv =
{[testenv]setenv}
PYTHON=coverage run --parallel-mode
commands =
find . -type f -name ".coverage.*" -delete
coverage erase
stestr run --no-subunit-trace {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report --fail-under=40 --skip-covered
find . -type f -name ".coverage.*" -delete
whitelist_externals =
find
# --- static analisys environments -------------------------------------------
[testenv:pep8]
basepython = {env:PYTHON:python3}
deps =
{[testenv]deps}
-r{toxinidir}/linters-requirements.txt
commands =
flake8 --max-complexity 10
[testenv:linters]
basepython = {[testenv:pep8]basepython}
whitelist_externals = bash
deps = {[testenv:pep8]deps}
envdir = {toxworkdir}/pep8
commands =
{[testenv:pep8]commands}
mypy --ignore-missing-imports tobiko/
# Ansible lint
# [ANSIBLE0012] Commands should not change things if nothing needs doing
bash -c 'find roles -maxdepth 1 -mindepth 1 -type d | \
xargs -t -n1 ansible-lint -xANSIBLE0012'
bash -c 'find playbooks -maxdepth 2 -type f -regex '.*.y[a]ml' | \
xargs -t -n1 ansible-lint -xANSIBLE0012'
pylint -j0 --max-line-length=80 -E -e W,E \
-d unused-import,broad-except,fixme tobiko
[flake8]
# H106: Don't put vim configuration in source files
# H203: Use assertIs(Not)None to check for None
# H204: Use assert(Not)Equal to check for equality
# H205: Use assert(Greater|Less)(Equal) for comparison
# H904: Delay string interpolations at logging calls.
enable-extensions = H106,H203,H204,H205,H904
show-source = true
exclude = ./.*,*lib/python*,build,dist,doc,*egg*,releasenotes,.venv
import-order-style = pep8
# --- integration test environments ------------------------------------------
[openstack]
basepython = {env:PYTHON:python3}
deps =
{[base]deps}
passenv =
{[base]passenv}
*_proxy
OS_*
setenv =
{[base]setenv}
ANSIBLE_CONFIG={env:ANSIBLE_CONFIG:{toxinidir}/ansible.cfg}
commands = {[base]commands}
[testenv:functional]
basepython = {[openstack]basepython}
deps = {[openstack]deps}
passenv = {[openstack]passenv}
setenv =
{[openstack]setenv}
OS_TEST_PATH={toxinidir}/tobiko/tests/functional
[testenv:scenario]
basepython = {[openstack]basepython}
deps = {[openstack]deps}
passenv = {[openstack]passenv}
setenv =
{[openstack]setenv}
OS_TEST_PATH={toxinidir}/tobiko/tests/scenario
[testenv:neutron]
basepython = {[openstack]basepython}
envdir = {toxworkdir}/scenario
deps = {[testenv:scenario]deps}
passenv = {[testenv:scenario]passenv}
setenv =
{[testenv:scenario]setenv}
OS_TEST_PATH={toxinidir}/tobiko/tests/scenario/neutron
[testenv:faults]
basepython = {[openstack]basepython}
envdir = {toxworkdir}/scenario
deps = {[testenv:scenario]deps}
passenv = {[testenv:scenario]passenv}
setenv =
{[testenv:scenario]setenv}
OS_TEST_PATH={toxinidir}/tobiko/tests/faults
commands =
stestr run --serial {posargs}
[testenv:venv]
basepython = {[openstack]basepython}
envdir = {toxworkdir}/scenario
deps = {[testenv:scenario]deps}
passenv = {[testenv:scenario]passenv}
setenv = {[testenv:scenario]setenv}
whitelist_externals = *
commands = {posargs:bash}
[testenv:infrared]
# On RedHat Linux must use the default unversioned python because of dependency on native SELinux
# package available only for /usr/bin/python interpreter
basepython = {env:IR_PYTHON:python}
usedevelop = false
skipdist = true
skip_install = true
sitepackages = true
whitelist_externals =
rm
deps =
-c{env:UPPER_CONSTRAINTS_FILE}
-rinfrared-requirements.txt
passenv =
{[testenv:venv]passenv}
ANSIBLE_*
IR_*
PYTHON
TERM
setenv =
{[testenv:venv]setenv}
ANSIBLE_CONFIG={env:ANSIBLE_CONFIG:{toxinidir}/ansible.cfg}
ANSIBLE_INVENTORY={env:ANSIBLE_INVENTORY:{toxinidir}/ansible_hosts}
IR_HOME={env:IR_HOME:{envdir}/home/infrared}
IR_TOBIKO_PLUGIN={env:IR_TOBIKO_PLUGIN:{toxinidir}/infrared_plugin}
IR_WORKSPACE_FILE={env:IR_WORKSPACE_FILE:{toxinidir}/workspace.tgz}
commands_pre =
{envpython} {toxinidir}/tools/setup_infrared.py
commands =
rm -fR '{toxinidir}/test_results'
ir tobiko \
--tobiko-src-dir {toxinidir} \
--collect-dir '{toxinidir}/test_results' \
--upper-constraints '{env:UPPER_CONSTRAINTS_FILE}' \
{posargs}
# --- documentation environments ----------------------------------------------
[docs]
basepython = {env:PYTHON:python3}
envdir = {toxworkdir}/docs
deps =
{[base]deps}
-r{toxinidir}/doc/requirements.txt
[testenv:docs]
basepython = {[docs]basepython}
envdir = {[docs]envdir}
deps = {[docs]deps}
changedir = doc/source
commands = sphinx-build -W -b html . ../build/html
[testenv:linkcheck]
basepython = {[docs]basepython}
envdir = {[docs]envdir}
deps = {[docs]deps}
commands = sphinx-build -W -b linkcheck doc/source doc/build/linkcheck
[testenv:releasenotes]
basepython = {[docs]basepython}
envdir = {[docs]envdir}
deps = {[docs]deps}
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
# --- CI report environments --------------------------------------------------
[testenv:report]
basepython = {env:PYTHON:python3}
usedevelop = false
skipdist = true
skip_install = true
deps = -r {toxinidir}/report-requirements.txt
passenv = {[base]passenv}
setenv = {[base]setenv}
commands = {toxinidir}/tools/ci/make_report
[testenv:bindep]
basepython = {env:PYTHON:python3}
# 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.
usedevelop = false
skipdist = true
skip_install = true
deps = bindep
commands = bindep {posargs:test}