20f211cbef
bindep is a helpful tox target to assist in determining what components a test environment needs to have installed. For stx-puppet, puppet-lint needs ruby headers otherwise the tox linters target will fail. Partial-Bug: #1907678 Signed-off-by: albailey <Al.Bailey@windriver.com> Change-Id: Iaccd8d8f3af292ef29028cde59f0d344b94f1d72
97 lines
2.7 KiB
INI
97 lines
2.7 KiB
INI
[tox]
|
|
envlist = linters,pep8,pylint
|
|
minversion = 2.3
|
|
skipsdist = True
|
|
sitepackages=False
|
|
|
|
[testenv]
|
|
install_command = pip install -U {opts} {packages}
|
|
setenv =
|
|
VIRTUAL_ENV={envdir}
|
|
OS_STDOUT_CAPTURE=1
|
|
OS_STDERR_CAPTURE=1
|
|
OS_DEBUG=1
|
|
OS_LOG_CAPTURE=1
|
|
deps =
|
|
-r{toxinidir}/requirements.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
whitelist_externals =
|
|
bash
|
|
|
|
[testenv:bashate]
|
|
# Treat all E* codes as Errors rather than warnings using: -e 'E*'
|
|
# The following codes are being suppressed:
|
|
# E006 Line too long
|
|
commands =
|
|
bash -c "find {toxinidir} \
|
|
-not \( -type d -name .?\* -prune \) \
|
|
-type f \
|
|
-not -name \*~ \
|
|
-not -name \*.md \
|
|
-name \*.sh \
|
|
-print0 | xargs -r -n 1 -0 bashate -v \
|
|
-i E006 \
|
|
-e 'E*'"
|
|
|
|
[testenv:bindep]
|
|
# 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.
|
|
deps = bindep
|
|
commands = bindep test
|
|
|
|
[testenv:linters]
|
|
# Note: centos developer env requires ruby-devel
|
|
# Ubuntu developer env requires ruby-dev
|
|
whitelist_externals =
|
|
gem
|
|
bash
|
|
setenv =
|
|
GEM_HOME = {envdir}
|
|
GEM_PATH = {envdir}
|
|
skip_tests = \
|
|
--no-autoloader_layout-check \
|
|
--no-documentation-check
|
|
commands =
|
|
gem install --no-document json puppet-lint:2.3.6
|
|
bash -c "find {toxinidir}/puppet-manifests {toxinidir}/modules \
|
|
-name \*.pp -print0 \
|
|
| xargs -0 puppet-lint --fail-on-warnings {[testenv:linters]skip_tests}"
|
|
{[testenv:bashate]commands}
|
|
|
|
[testenv:pep8]
|
|
basepython = python3
|
|
usedevelop = False
|
|
description =
|
|
Run style checks.
|
|
|
|
|
|
commands =
|
|
flake8 puppet-manifests/src/modules/platform/files
|
|
|
|
[testenv:pylint]
|
|
basepython = python3
|
|
sitepackages = False
|
|
|
|
deps = {[testenv]deps}
|
|
ruamel.yaml
|
|
pylint<2.5.0
|
|
commands =
|
|
pylint {posargs} --rcfile=./pylint.rc puppet-manifests
|
|
|
|
[flake8]
|
|
# E123, E125 skipped as they are invalid PEP-8.
|
|
# E501 skipped because some of the code files include templates
|
|
# that end up quite wide
|
|
# H405: multi line docstring summary not separated with an empty line
|
|
show-source = True
|
|
ignore = E123,E125,E501,H405,W504
|
|
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
|
|
|
[testenv:bandit]
|
|
basepython = python3
|
|
description = Bandit code scan for *.py files under config folder
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
commands = bandit -r {toxinidir}/ -x '**/.tox/**,**/.eggs/**' -lll
|