Tweaks in tox.ini to speed it up

Reworked several environments where installing of the
package (monasca-log-api) is not necessary.

Also added validating all bash files with bashate
for the devstack plugin part.

Change-Id: I02bd5bfcc3bfbdfda30bc9b6bcc977b37c6c3674
This commit is contained in:
Tomasz Trębski 2017-07-12 13:56:59 +02:00
parent 022147484e
commit 86433df26f
3 changed files with 37 additions and 20 deletions

View File

@ -5,6 +5,7 @@
# Install bounded pep8/pyflakes first, then let flake8 install
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
bandit>=1.1.0 # Apache-2.0
bashate>=0.2 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
coverage!=4.4,>=4.0 # Apache-2.0

6
tools/bashate.sh Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Ignore too long lines error E006 from bashate and treat
# E005, E042 as errors.
SH_FILES=$(find $1 -type d -name files -prune -o -type f -name '*.sh' -print)
bashate -v -iE006 -eE005,E042 ${SH_FILES:-''}

50
tox.ini
View File

@ -1,6 +1,6 @@
[tox]
envlist = py{27,35},pep8,cover
minversion = 2.1
minversion = 2.7
skipsdist = True
[testenv]
@ -8,12 +8,8 @@ usedevelop = True
setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=monasca_log_api/tests
CLIENT_NAME=monasca-log-api
passenv = http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
passenv = *_proxy
*_PROXY
whitelist_externals = bash
find
rm
@ -54,33 +50,35 @@ commands =
[testenv:bashate]
description = Validates (pep8-like) devstack plugins
deps = bashate
whitelist_externals = bashate
commands =
# Ignore too long lines error E006 from bashate and treat
# E005, E042 as errors.
bashate -v -iE006 -eE005,E042 {toxinidir}/devstack/plugin.sh
skip_install = True
usedevelop = False
commands = bash {toxinidir}/tools/bashate.sh {toxinidir}/devstack
[testenv:bandit]
description = Validates codebase with bandit
skip_install = True
usedevelop = False
commands =
# FIXME(dmllr); B101 needs to be fixed first
bandit -r monasca_log_api -n5 -s B101 -x monasca_log_api/tests
[testenv:flake8]
commands =
flake8 monasca_log_api
[testenv:pep8]
description = Runs set of linters against codebase (flake8, bandit, bashate, checkniceness)
deps =
{[testenv]deps}
{[testenv:bashate]deps}
commands =
{[testenv]commands}
{[testenv:flake8]commands}
{[testenv:bandit]commands}
{[testenv:bashate]commands}
{[testenv:checkniceness]commands}
[testenv:flake8]
description = Validates codebase with flake
skip_install = True
usedevelop = False
commands =
{[testenv]commands}
flake8 monasca_log_api
[testenv:genconfig]
description = Generates sample documentation file for monasca-log-api
commands = oslo-config-generator --config-file=config-generator/monasca-log-api.conf
@ -88,6 +86,7 @@ commands = oslo-config-generator --config-file=config-generator/monasca-log-api.
[testenv:docs]
description = Builds api-ref, api-guide, releasenotes and devdocs
commands =
{[testenv]commands}
{[testenv:devdocs]commands}
{[testenv:api-guide]commands}
{[testenv:api-ref]commands}
@ -96,6 +95,7 @@ commands =
[testenv:api-guide]
description = Called from CI scripts to test and publish the API Guide
commands =
{[testenv]commands}
rm -rf api-guide/build
{[testenv:checkjson]commands}
sphinx-build -W -b html -d api-guide/build/doctrees api-guide/source api-guide/build/html
@ -103,6 +103,7 @@ commands =
[testenv:api-ref]
description = Called from CI scripts to test and publish the API Ref
commands =
{[testenv]commands}
rm -rf api-ref/build
{[testenv:checkjson]commands}
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
@ -116,6 +117,7 @@ commands =
[testenv:devdocs]
description = Builds developer documentation
commands =
{[testenv]commands}
rm -rf doc/build
rm -rf doc/source/contributor/api
{[testenv:checkjson]commands}
@ -123,7 +125,10 @@ commands =
[testenv:checkniceness]
description = Validates (pep-like) documenation
skip_install = True
usedevelop = False
commands =
{[testenv]commands}
doc8 --file-encoding utf-8 {toxinidir}/doc
doc8 --file-encoding utf-8 {toxinidir}/api-ref
doc8 --file-encoding utf-8 {toxinidir}/api-guide
@ -131,11 +136,16 @@ commands =
[testenv:checkjson]
description = Validates all json samples inside doc folder
skip_install = True
usedevelop = False
deps =
whitelist_externals =
bash
python
find
rm
commands =
{[testenv]commands}
bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'