octavia/tox.ini

179 lines
5.4 KiB
INI

[tox]
minversion = 1.6
envlist = docs,py35,py27,functional,pep8,specs
skipsdist = True
[testenv]
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
install_command =
pip install -U -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
whitelist_externals = find
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
stestr run '{posargs}'
stestr slowest
[testenv:api-ref]
# This environment is called from CI scripts to test and publish
# the API Ref to developer.openstack.org.
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
whitelist_externals = rm
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
[testenv:cover]
whitelist_externals = sh
setenv =
{[testenv]setenv}
PYTHON=coverage run --source octavia --parallel-mode
commands =
coverage erase
sh -c 'OS_TEST_PATH={toxinidir}/octavia/tests/unit stestr run {posargs}'
sh -c 'OS_TEST_PATH={toxinidir}/octavia/tests/functional stestr run {posargs}'
coverage combine
coverage report --fail-under=80 --skip-covered
# Generate a new HTML report with the combined results
# otherwise the HTML report will only show partial results
coverage html -d cover
[testenv:functional]
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:functional-py35]
basepython = python3.5
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:debug]
commands = oslo_debug_helper {posargs}
[testenv:debug-py27]
basepython = python2.7
commands = oslo_debug_helper {posargs}
[testenv:debug-py35]
basepython = python3.5
commands = oslo_debug_helper {posargs}
[testenv:pep8]
commands = flake8
# RST linter
doc8 --ignore-path doc/source/contributor/modules specs \
doc/source octavia CONSTITUTION.rst HACKING.rst README.rst \
TESTING.rst
# Run security linter
bandit -r octavia -ll -ii -x octavia/tests
# Make sure specs follow our template
find . -type f -name "*.pyc" -delete
python -m unittest specs-tests.test_titles
sh ./tools/misc-sanity-checks.sh
{toxinidir}/tools/coding-checks.sh --pylint '{posargs}'
whitelist_externals =
sh
find
[testenv:docs]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
whitelist_externals = rm
commands =
rm -rf doc/build api-guide/build api-ref/build doc/source/contributor/modules
sphinx-build -W -b html doc/source doc/build/html
sphinx-build -W -b html api-ref/source api-ref/build/html
[testenv:venv]
commands = {posargs}
[testenv:genconfig]
whitelist_externals = mkdir
commands =
mkdir -p etc/octavia
oslo-config-generator --output-file etc/octavia/octavia.conf.sample \
--namespace octavia \
--namespace oslo.db \
--namespace oslo.log \
--namespace oslo.messaging \
--namespace keystonemiddleware.auth_token
[testenv:genpolicy]
whitelist_externals = mkdir
commands =
mkdir -p etc/octavia
oslopolicy-sample-generator \
--config-file etc/policy/octavia-policy-generator.conf \
--output-file etc/octavia/json.policy.sample
[testenv:specs]
whitelist_externals =
rm
find
commands =
find . -type f -name "*.pyc" -delete
python -m unittest specs-tests.test_titles
[testenv:bandit]
commands = bandit -r octavia -ll -ii -x octavia/tests {posargs}
[flake8]
ignore = H104
show-source = true
builtins = _
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build
import-order-style = pep8
# [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
[hacking]
import_exceptions = octavia.i18n
local-check-factory = octavia.hacking.checks.factory
[doc8]
max-line-length = 79
[testenv:releasenotes]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
# If you are running the tests locally you should set the env variable
# TEMPEST_CONFIG_DIR=/opt/stack/tempest/etc
[testenv:apiv1]
passenv = TEMPEST_CONFIG_DIR
setenv =
OS_TEST_PATH={toxinidir}/octavia/tests/tempest/v1/api
commands =
stestr run --concurrency 1 '{posargs}'
stestr slowest
# If you are running the tests locally you should set the env variable
# TEMPEST_CONFIG_DIR=/opt/stack/tempest/etc
[testenv:scenario]
passenv = TEMPEST_CONFIG_DIR
setenv =
OS_TEST_PATH={toxinidir}/octavia/tests/tempest/v1/scenario
commands =
stestr run --concurrency 1 '{posargs}'
stestr slowest
[testenv:lower-constraints]
basepython = python3
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt