Michael Johnson 77b8baea5d Update hacking
This patch updates the version of hacking to be consistent with octavia.
It is also required for flake8 to understand f-strings correctly.
Along with this version update, the patch fixes issues in the code found
by the new versions.

This patch also removes O349 check for importing mock since flake8 has
added H216 which does the same check.

Change-Id: I8e49fc19faff59b2811a7ee09b7ccaa286f73d82
2024-12-10 09:14:56 +01:00

117 lines
3.3 KiB
INI

[tox]
minversion = 3.18.0
envlist = pep8
ignore_basepython_conflict = True
[testenv]
basepython = python3
usedevelop = True
install_command = pip install {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
commands =
stestr run {posargs}
stestr slowest
[testenv:pep8]
commands =
flake8
check-uuid --package octavia_tempest_plugin
[testenv:uuidgen]
commands = check-uuid --fix --package octavia_tempest_plugin
[testenv:venv]
commands = {posargs}
[testenv:cover]
setenv =
{[testenv]setenv}
PYTHON=coverage run --source octavia_tempest_plugin --parallel-mode
allowlist_externals =
find
commands =
find octavia_tempest_plugin -type f -name "*.pyc" -delete
coverage erase
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:docs]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
allowlist_externals = rm
commands =
rm -rf doc/build
sphinx-build -W -b html doc/source doc/build/html
[testenv:pdf-docs]
deps = {[testenv:docs]deps}
allowlist_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:releasenotes]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:debug]
commands = oslo_debug_helper {posargs}
[flake8]
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
[flake8:local-plugins]
extension =
O316 = checks:assert_true_instance
O318 = checks:assert_equal_or_not_none
O323 = checks:assert_equal_true_or_false
O324 = checks:no_mutable_default_args
O338 = checks:assert_equal_in
O339 = checks:no_log_warn
O341 = checks:no_translate_logs
O342 = checks:check_raised_localized_exceptions
O345 = checks:check_no_eventlet_imports
O346 = checks:check_line_continuation_no_backslash
O347 = checks:revert_must_have_kwargs
O348 = checks:check_no_logging_imports
paths =
./octavia_tempest_plugin/hacking
[testenv:genconfig]
allowlist_externals = mkdir
commands =
mkdir -p etc
oslo-config-generator --output-file etc/octavia.tempest.conf.sample \
--namespace tempest.config
[testenv:requirements]
deps =
-egit+https://opendev.org/openstack/requirements#egg=openstack-requirements
allowlist_externals = sh
commands =
sh -c '{envdir}/src/openstack-requirements/playbooks/files/project-requirements-change.py --req {envdir}/src/openstack-requirements --local {toxinidir} master'