98448dce44
Added the bashate script style checker to the pep8 check target in tox.ini. It actually found two valid issues - a bad function declaration and a local variable issue, but mostly just indentation noise. Fixed all the complaints. Change-Id: I43b60e7dcf53acf259c8a52b248fbb8c63d3c8d4
221 lines
6.7 KiB
INI
221 lines
6.7 KiB
INI
[tox]
|
|
minversion = 2.5.0
|
|
envlist = docs,py27,py36,py37,functional-py37,functional-py36,functional,pep8,specs
|
|
skipsdist = True
|
|
|
|
[testenv]
|
|
usedevelop = True
|
|
setenv = VIRTUAL_ENV={envdir}
|
|
PYTHONWARNINGS=default::DeprecationWarning
|
|
install_command =
|
|
pip install {opts} {packages}
|
|
whitelist_externals = find
|
|
deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
|
-r{toxinidir}/requirements.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
commands =
|
|
stestr run {posargs}
|
|
stestr slowest
|
|
|
|
[testenv:api-ref]
|
|
basepython = python3
|
|
# This environment is called from CI scripts to test and publish
|
|
# the API Ref to docs.openstack.org.
|
|
deps =
|
|
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
|
-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]
|
|
basepython = python3
|
|
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
|
|
# Generate a new HTML report with the combined results
|
|
# otherwise the HTML report will only show partial results
|
|
coverage html -d cover
|
|
coverage xml -o cover/coverage.xml
|
|
coverage report --fail-under=90 --skip-covered
|
|
|
|
[testenv:functional]
|
|
# This is set as py27 right now, though the name is ambiguous.
|
|
basepython = python2.7
|
|
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
|
|
|
|
[testenv:functional-py27]
|
|
basepython = python2.7
|
|
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
|
|
|
|
[testenv:functional-py36]
|
|
basepython = python3.6
|
|
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
|
|
|
|
[testenv:functional-py37]
|
|
basepython = python3.7
|
|
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
|
|
|
|
[testenv:debug]
|
|
basepython = python3
|
|
commands = oslo_debug_helper {posargs}
|
|
|
|
[testenv:debug-py27]
|
|
basepython = python2.7
|
|
commands = oslo_debug_helper {posargs}
|
|
|
|
[testenv:pep8]
|
|
basepython = python3
|
|
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}
|
|
{[testenv:bashate]commands}
|
|
whitelist_externals =
|
|
sh
|
|
find
|
|
bash
|
|
|
|
[testenv:docs]
|
|
basepython = python3
|
|
deps =
|
|
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
|
-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:pdf-docs]
|
|
basepython = python3
|
|
deps = {[testenv:docs]deps}
|
|
whitelist_externals =
|
|
make
|
|
rm
|
|
commands =
|
|
rm -rf doc/build/pdf
|
|
sphinx-build -W -b latex doc/source doc/build/pdf
|
|
make -C doc/build/pdf
|
|
|
|
[testenv:venv]
|
|
basepython = python3
|
|
commands = {posargs}
|
|
|
|
[testenv:genconfig]
|
|
basepython = python3
|
|
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]
|
|
basepython = python3
|
|
whitelist_externals = mkdir
|
|
commands =
|
|
mkdir -p etc/octavia
|
|
oslopolicy-sample-generator \
|
|
--config-file etc/policy/octavia-policy-generator.conf
|
|
|
|
[testenv:specs]
|
|
basepython = python3
|
|
whitelist_externals =
|
|
rm
|
|
find
|
|
commands =
|
|
find . -type f -name "*.pyc" -delete
|
|
python -m unittest specs-tests.test_titles
|
|
|
|
|
|
[testenv:bandit]
|
|
basepython = python3
|
|
commands = bandit -r octavia -ll -ii -x octavia/tests {posargs}
|
|
|
|
[flake8]
|
|
# [H104]: Empty file with only comments
|
|
# [W504]: Line break after binary operator
|
|
ignore = H104,W504
|
|
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
|
|
|
|
[testenv:bashate]
|
|
basepython = python3
|
|
envdir = {toxworkdir}/shared
|
|
commands = bash -c "find {toxinidir} \
|
|
-not \( -type d -name .tox\* -prune \) \
|
|
-not \( -type d -name .venv\* -prune \) \
|
|
-type f \
|
|
-name \*.sh \
|
|
# [E005]: File does not begin with #! or have a .sh prefix
|
|
# [E006]: Check for lines longer than 79 columns
|
|
# [E042]: Local declaration hides errors
|
|
# [E043]: Arithmetic compound has inconsistent return semantics
|
|
-print0 | xargs -0 bashate -v -iE006 -eE005,E042,E043"
|
|
|
|
[hacking]
|
|
import_exceptions = octavia.i18n
|
|
local-check-factory = octavia.hacking.checks.factory
|
|
|
|
[doc8]
|
|
max-line-length = 79
|
|
|
|
[testenv:releasenotes]
|
|
basepython = python3
|
|
deps =
|
|
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
|
-r{toxinidir}/requirements.txt
|
|
-r{toxinidir}/doc/requirements.txt
|
|
whitelist_externals = rm
|
|
commands =
|
|
rm -rf releasenotes/build
|
|
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
|
|
|
[testenv:lower-constraints]
|
|
basepython = python3
|
|
deps =
|
|
-c{toxinidir}/lower-constraints.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
-r{toxinidir}/requirements.txt
|
|
whitelist_externals = sh
|
|
commands =
|
|
sh -c 'OS_TEST_PATH={toxinidir}/octavia/tests/unit stestr run {posargs}'
|
|
sh -c 'OS_TEST_PATH={toxinidir}/octavia/tests/functional stestr run {posargs}'
|
|
|
|
[testenv:requirements]
|
|
basepython = python3
|
|
deps =
|
|
-egit+https://opendev.org/openstack/requirements#egg=openstack-requirements
|
|
whitelist_externals = sh
|
|
commands =
|
|
sh -c '{envdir}/src/openstack-requirements/playbooks/files/project-requirements-change.py --req {envdir}/src/openstack-requirements --local {toxinidir} master'
|