Files
distcloud-client/distributedcloud-client/tox.ini
Hugo Brito b5cbd9480c Create a zuul job for black formatter
Create a Zuul job to check Black Formatter in the code.
This commit also applies the Black formatter to the entire project.

Test Plan
Pass - Success on stx-distcloud-client-tox-black
Pass - Success on tox command

Story: 2011149
Task: 50393

Change-Id: I5d7b537e83931304ffd5f67ce51e8ebb44f7e65b
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2024-06-24 09:52:54 -03:00

83 lines
2.0 KiB
INI

[tox]
envlist = py39,pep8,pylint,black_check
minversion = 4.4.0
skipsdist = True
toxworkdir = /tmp/{env:USER}_dc_client_tox
[dcclient]
client_base_dir = .
[testenv]
basepython = python3.9
setenv =
VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
allowlist_externals =
rm
find
[testenv:py39]
skipdist = False
commands =
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
stestr --test-path={[dcclient]client_base_dir}/dcmanagerclient/tests run '{posargs}'
[testenv:pep8]
commands = flake8
[flake8]
# E203 whitespace before ':'
# W503 line break before binary operator
# W504 line break after binary operator
# W605 invalid escape sequence
# E203 and W503 are not compatible with Black formatter
show-source = True
max-line-length = 88
ignore = E203, W503, W504, W605
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[testenv:pylint]
commands =
pylint {posargs} dcmanagerclient --rcfile=./.pylintrc
[testenv:black]
# This environment automatically applies the Black formatter to all Python files in
# the project.
deps =
black>=23.11.0 # MIT
commands =
black {posargs} .
[testenv:black_check]
# This environment checks and displays the recommended changes by Black for formatting
# Python files.
deps =
black>=23.11.0 # MIT
commands =
black --check --diff .
[testenv:cover]
setenv =
PYTHON=coverage run --parallel-mode
PYTHONDONTWRITEBYTECODE=True
commands =
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
coverage erase
stestr --test-path={[dcclient]client_base_dir}/dcmanagerclient/tests run '{posargs}'
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:debug]
commands = oslo_debug_helper {posargs}