87b365afd3
With the switch to Ubuntu Focal for tox jobs via https://review.opendev.org/#/c/738322/ our 1.1.0 version of hacking pulls in old modules that are not compatible with python3.8: https://github.com/openstack/hacking/blob/1.1.0/requirements.txt#L6 Let's upgrade hacking to >= 3.0.1 and < 3.1.0 so that it supports python3.8 correctly. The newer hacking also triggered new errors which are fixed in this review as well: ./tools/render-ansible-tasks.py:113:25: F841 local variable 'e' is assigned to but never used ./tools/yaml-validate.py:541:19: F999 '...'.format(...) has unused arguments at position(s): 2 ./tools/render-ansible-tasks.py:126:1: E305 expected 2 blank lines after class or function definition, found 1 ./tools/yaml-validate.py:33:1: E305 expected 2 blank lines after class or function definition, found 1 ./container_config_scripts/tests/test_nova_statedir_ownership.py:35:1: E305 expected 2 blank lines after class or function definition, found 0 Also make sure we exclude .tox and __pycache__ from flake8 as well We also need to change the lower-constraint requirements to make them py3.8 compatible. See https://bugs.launchpad.net/nova/+bug/1886298 cffi==1.14.0 greenlet==0.4.15 MarkupSafe==1.1.0 paramiko==2.7.1 Suggested-By: Yatin Karel <ykarel@redhat.com> Change-Id: Ic280ce9a51f26d165d4e93ba0dc0c47cdf8d7961 Closes-Bug: #1895093
115 lines
3.4 KiB
INI
115 lines
3.4 KiB
INI
[tox]
|
|
minversion = 2.0
|
|
skipsdist = True
|
|
envlist = pep8,py37,tht
|
|
|
|
[testenv]
|
|
basepython = python3
|
|
usedevelop = True
|
|
deps =
|
|
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
|
|
-r{toxinidir}/requirements.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
|
|
|
[testenv:venv]
|
|
commands = {posargs}
|
|
|
|
[testenv:pep8]
|
|
whitelist_externals =
|
|
bash
|
|
commands =
|
|
python ./tools/process-templates.py
|
|
python ./network/endpoints/build_endpoint_map.py --check
|
|
python ./tools/yaml-validate.py .
|
|
bash -c ./tools/roles-data-validation.sh
|
|
bash -c ./tools/check-up-to-date.sh
|
|
flake8 --exclude releasenotes,.tox,__pycache__ --ignore {[testenv:flake8]ignore}
|
|
|
|
[testenv:flake8]
|
|
# E125 is deliberately excluded. See
|
|
# https://github.com/jcrocholl/pep8/issues/126. It's just wrong.
|
|
#
|
|
# Most of the whitespace related rules (E12* and E131) are excluded
|
|
# because while they are often useful guidelines, strict adherence to
|
|
# them ends up causing some really odd code formatting and forced
|
|
# extra line breaks. Updating code to enforce these will be a hard sell.
|
|
#
|
|
# H405 is another one that is good as a guideline, but sometimes
|
|
# multiline doc strings just don't have a natural summary
|
|
# line. Rejecting code for this reason is wrong.
|
|
#
|
|
# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301
|
|
#
|
|
# The following two are also ignored that we don't think it is useful.
|
|
# W503 line break before binary operator
|
|
# W504 line break after binary operator
|
|
#
|
|
# The following rules are currently ignored, but will be enforced
|
|
# in the future
|
|
# E501 line too long
|
|
# E731 do not assign a lambda expression, use a def
|
|
# W605 invalid escape sequence
|
|
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405,W503,W504,E501,E731,W605
|
|
exclude = releasenotes
|
|
|
|
[testenv:templates]
|
|
commands = python ./tools/process-templates.py
|
|
|
|
[testenv:clean]
|
|
commands = python ./tools/process-templates.py -c
|
|
|
|
[testenv:releasenotes]
|
|
whitelist_externals =
|
|
bash
|
|
commands = bash -c tools/releasenotes_tox.sh
|
|
|
|
[testenv:cover]
|
|
commands = python setup.py test --coverage --coverage-package-name=tripleo_heat_templates --testr-args='{posargs}'
|
|
|
|
[testenv:genconfig]
|
|
commands =
|
|
python ./tools/process-templates.py
|
|
python ./tripleo_heat_templates/environment_generator.py sample-env-generator/
|
|
|
|
[testenv:genroledata]
|
|
whitelist_externals =
|
|
bash
|
|
commands =
|
|
bash -c tools/roles-data-generate-samples.sh
|
|
|
|
[testenv:lower-constraints]
|
|
deps =
|
|
-c{toxinidir}/lower-constraints.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
-r{toxinidir}/requirements.txt
|
|
|
|
[testenv:tht]
|
|
usedevelop = True
|
|
setenv =
|
|
ANSIBLE_FORCE_COLOR=1
|
|
ANSIBLE_INVENTORY={toxinidir}/test/hosts.ini
|
|
ANSIBLE_THT_FOLDER={toxinidir}
|
|
ANSIBLE_NOCOWS=1
|
|
ANSIBLE_RETRY_FILES_ENABLED=0
|
|
ANSIBLE_STDOUT_CALLBACK=debug
|
|
PY_COLORS=1
|
|
VIRTUAL_ENV={envdir}
|
|
# Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207
|
|
PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
passenv =
|
|
ANSIBLE_*
|
|
deps =
|
|
-r{toxinidir}/test-ansible-requirements.txt
|
|
whitelist_externals =
|
|
bash
|
|
commands_pre =
|
|
pip install -q bindep
|
|
bindep test
|
|
commands =
|
|
pytest --color=no \
|
|
--html={envlogdir}/reports.html \
|
|
--self-contained-html \
|
|
{toxinidir}/tripleo_heat_templates/tests/test_tht_ansible_syntax.py
|