update/tox.ini
Al Bailey bcc938ca12 Add additional checks to flake8 job
By setting 'hacking' as the dependency, flake8
will include hacking and other checks.
This is the same set used by other openstack
components.

This commit suppresses any of those new checks that
would fail.
 H101  Use TODO(NAME)
 H102  Apache 2.0 license header not found
 H105  Don't use author tags
 H237  module posixfile is removed in Python 3
 H238  old style class declaration
 H301  one import per line
 H306  imports not in alphabetical order
 H401  docstring should not start with a space
 H404  multi line docstring should start without a leading new line
 H405  multi line docstring summary not separated with an empty line

It also sets the max line length to be very large.

At a later time, additional commits will fix and un-suppress them.

Story: 2004515
Task: 29303
Change-Id: Id572d5c0ecab1854ca881e34b95459ef563be0f2
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2019-02-04 09:00:45 -06:00

163 lines
4.9 KiB
INI
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
[tox]
envlist = linters,pep8,py27,py35,pylint
minversion = 2.3
skipsdist = True
[testenv]
install_command = pip install -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
PYTHONDONTWRITEBYTECODE=True
cgcs_patch_dir = {toxinidir}/cgcs-patch/cgcs-patch
cgcs_patch_src_dir = {[testenv]cgcs_patch_dir}/cgcs_patch
patch_alarm_dir = {toxinidir}/patch-alarm/patch-alarm
patch_alarm_src_dir = {[testenv]patch_alarm_dir}/patch_alarm
tsconfig_dir = {toxinidir}/tsconfig/tsconfig
tsconfig_src_dir = {[testenv]tsconfig_dir}/tsconfig
commands = find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
{[testenv]cgcs_patch_dir}
{[testenv]patch_alarm_dir}
{[testenv]tsconfig_dir}
[testenv:linters]
basepython = python3
whitelist_externals = bash
commands =
bash -c "find {toxinidir} \
\( -name .tox -prune \) \
-o -type f -name '*.yaml' \
-print0 | xargs --no-run-if-empty -0 yamllint"
bash -c "find {toxinidir} \
-not \( -type d -name .?\* -prune \) \
-type f \
-not -name \*~ \
-not -name \*.md \
-name \*.sh \
-print0 | xargs --no-run-if-empty -0 bashate -v -e 'E*' -iE006"
[flake8]
# ignore below errors , will fix flake8 errors in future
# H101 Use TODO(NAME)
# H102 Apache 2.0 license header not found
# H105 Don't use author tags
# H237 module posixfile is removed in Python 3
# H238 old style class declaration
# H301 one import per line
# H306 imports not in alphabetical order
# H401 docstring should not start with a space
# H404 multi line docstring should start without a leading new line
# H405 multi line docstring summary not separated with an empty line
# E501 skipped because some of the code files include templates
# that end up quite wide
# F401 'XXXXX' imported but unused
# F841 local variable 'XXXXXX' is assigned to but never used
show-source = True
ignore = H101,H102,H105,H237,H238,H301,H306,H401,H404,H405,E501,F401,F841
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
# TODO: H106 Dont put vim configuration in source files (off by default).
# H203 Use assertIs(Not)None to check for None (off by default).
# TODO: enable: H904 Delay string interpolations at logging calls (off by default).
enable-extensions = H203
max-line-length = 120
# Use flake8 to replace pep8.
[testenv:pep8]
basepython = python3
usedevelop = False
skip_install = True
commands =
flake8
[testenv:venv]
basepython = python3
commands = {posargs}
[nosetests]
verbosity=2
[testenv:py27]
basepython = python2.7
deps = {[testenv]deps}
whitelist_externals = cp
find
recreate = True
commands = {[testenv]commands}
[testenv:py35]
basepython = python3
deps = {[testenv]deps}
whitelist_externals = cp
find
recreate = True
commands = {[testenv]commands}
[testenv:pylint]
deps = {[testenv]deps}
pylint
-e{toxinidir}/../stx-config/sysinv/sysinv/sysinv
-e{toxinidir}/../stx-fault/fm-api
pyCrypto
daemon
keystoneauth1
keystonemiddleware
netaddr
oslo_config
pecan
requests
requests_toolbelt
rpm
basepython = python2.7
commands = pylint {[testenv]cgcs_patch_src_dir} \
{[testenv]patch_alarm_src_dir} \
{[testenv]tsconfig_src_dir} \
--rcfile=./pylint.rc
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
whitelist_externals = rm
[testenv:releasenotes]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf releasenotes/build
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
whitelist_externals =
rm
reno
[testenv:newnote]
basepython = python3
# Re-use the releasenotes venv
envdir = {toxworkdir}/releasenotes
deps = -r{toxinidir}/doc/requirements.txt
commands = reno new {posargs}
[testenv:api-ref]
basepython = python3
deps =
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
whitelist_externals = rm