
We need to specify doc requirements in doc/requirements.txt to avoid problems with the pip resolver [1] for the release team [2][3]. Removing specific doc requirements from test-requirements.txt. The problem here is that this repos haven't doc/requirements.txt file and by default in this case zuul will use the test-requirements.txt file to pull requirements [4]. This requirements file contains extra requirements like flake8 that collided with those allowed in our job environment and so the new pip resolver fails to install these requirements and the job exits in error. This project meet the conditions leading to the bug. [1] http://lists.openstack.org/pipermail/release-job-failures/2021-January/001500.html [2] http://lists.openstack.org/pipermail/openstack-discuss/2021-January/019611.html [3] http://lists.openstack.org/pipermail/openstack-discuss/2021-January/019612.html [4] https://opendev.org/zuul/zuul-jobs/src/branch/master/roles/ensure-sphinx/tasks/main.yaml#L36 Change-Id: I582c7b1b8008e72f376a24a58ca1ee5ac4d933bb
185 lines
5.0 KiB
INI
185 lines
5.0 KiB
INI
[tox]
|
|
envlist = py38,pep8,cover
|
|
minversion = 2.7
|
|
skipsdist = True
|
|
|
|
[testenv]
|
|
basepython = python3
|
|
setenv =
|
|
VIRTUAL_ENV={envdir}
|
|
OS_TEST_PATH=monasca_api/tests
|
|
passenv = *_proxy
|
|
*_PROXY
|
|
usedevelop = True
|
|
install_command = pip install {opts} {packages}
|
|
deps =
|
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
|
-r{toxinidir}/test-requirements.txt
|
|
-r{toxinidir}/requirements.txt
|
|
.[influxdb,cassandra]
|
|
whitelist_externals = bash
|
|
find
|
|
rm
|
|
commands =
|
|
find . -type f -name "*.pyc" -delete
|
|
stestr run {posargs}
|
|
|
|
[testenv:cover]
|
|
description = Calculates code coverage
|
|
setenv =
|
|
PYTHON=coverage run --source monasca_api --parallel-mode
|
|
commands =
|
|
stestr run {posargs}
|
|
coverage combine
|
|
coverage html -d cover
|
|
coverage xml -o cover/coverage.xml
|
|
|
|
[testenv:debug]
|
|
commands =
|
|
oslo_debug_helper -t ./monasca_api/tests {posargs}
|
|
|
|
[testenv:flake8]
|
|
skip_install = True
|
|
usedevelop = False
|
|
commands =
|
|
flake8 monasca_api
|
|
|
|
[testenv:bandit]
|
|
skip_install = True
|
|
usedevelop = False
|
|
commands =
|
|
# B101(assert_ussed) - API uses asserts because of performance reasons
|
|
# B303 - Fingerprint class uses SHA1 to map fingerprints to alembic revisions.
|
|
bandit -r monasca_api -n5 -s B101,B303 -x monasca_api/tests
|
|
|
|
[testenv:bashate]
|
|
skip_install = True
|
|
usedevelop = False
|
|
commands = bash {toxinidir}/tools/bashate.sh
|
|
|
|
[testenv:pep8]
|
|
commands =
|
|
{[testenv:flake8]commands}
|
|
{[testenv:bandit]commands}
|
|
{[testenv:bashate]commands}
|
|
{[testenv:checkniceness]commands}
|
|
|
|
[testenv:docs]
|
|
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
|
-r{toxinidir}/doc/requirements.txt
|
|
description = Builds api-ref, api-guide, releasenotes and devdocs
|
|
commands =
|
|
{[testenv:devdocs]commands}
|
|
{[testenv:api-ref]commands}
|
|
{[testenv:releasenotes]commands}
|
|
|
|
[testenv:pdf-docs]
|
|
deps = {[testenv:docs]deps}
|
|
envdir = {toxworkdir}/docs
|
|
whitelist_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:api-ref]
|
|
deps = {[testenv:docs]deps}
|
|
description = Called from CI scripts to test and publish the API Ref
|
|
commands =
|
|
rm -rf api-ref/build
|
|
{[testenv:checkjson]commands}
|
|
sphinx-build -W -b html -d api-ref/build/doctrees \
|
|
api-ref/source api-ref/build/html
|
|
|
|
[testenv:releasenotes]
|
|
deps = {[testenv:docs]deps}
|
|
description = Called from CI script to test and publish the Release Notes
|
|
commands =
|
|
rm -rf releasenotes/build
|
|
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html \
|
|
releasenotes/source releasenotes/build/html
|
|
|
|
[testenv:devdocs]
|
|
deps = {[testenv:docs]deps}
|
|
description = Builds developer documentation
|
|
commands =
|
|
rm -rf doc/build doc/source/contributor/api
|
|
{[testenv:checkjson]commands}
|
|
python setup.py build_sphinx
|
|
|
|
[testenv:checkniceness]
|
|
skip_install = True
|
|
usedevelop = False
|
|
description = Validates (pep-like) documenation
|
|
commands =
|
|
rm -rf {toxinidir}/doc/source/contributor/api {toxinidir}/doc/build \
|
|
{toxinidir}/api-ref/build {toxinidir}/releasenotes/build
|
|
doc8 --file-encoding utf-8 {toxinidir}/doc
|
|
doc8 --file-encoding utf-8 {toxinidir}/api-ref
|
|
doc8 --file-encoding utf-8 {toxinidir}/releasenotes
|
|
|
|
[testenv:checkjson]
|
|
description = Validates all json samples inside doc folder
|
|
deps =
|
|
skip_install = True
|
|
usedevelop = False
|
|
whitelist_externals =
|
|
python
|
|
bash
|
|
commands =
|
|
bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
|
|
bash -c '! find doc/ -type f -name *.json | \
|
|
xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
|
|
|
|
[testenv:genconfig]
|
|
description = Generates sample configuration file for monasca-api
|
|
commands = oslo-config-generator --config-file=config-generator/monasca-api.conf
|
|
|
|
[testenv:genpolicy]
|
|
description = Generates sample policy.json file for monasca-api
|
|
commands = oslopolicy-sample-generator --config-file=config-generator/policy.conf
|
|
|
|
[testenv:venv]
|
|
commands = {posargs}
|
|
|
|
[testenv:bindep]
|
|
deps = bindep
|
|
commands = bindep test
|
|
|
|
[flake8]
|
|
# TODO: ignored checks should be enabled in the future
|
|
# H201 no 'except:' at least use 'except Exception:'
|
|
# H302 import only modules
|
|
# H405 multi line docstring summary not separated with an empty line
|
|
# W504 line break after binary operator
|
|
ignore = F821,H201,H302,H405,W504
|
|
# 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.
|
|
enable-extensions=H106,H203,H204,H205
|
|
max-complexity = 50
|
|
max-line-length = 100
|
|
builtins = _
|
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools,build
|
|
show-source = True
|
|
|
|
[hacking]
|
|
local-check-factory = monasca_api.hacking.checks.factory
|
|
import_exceptions =
|
|
six.moves
|
|
|
|
[flake8:local-plugins]
|
|
extension =
|
|
B319 = checks:no_xrange
|
|
paths = ./monasca_api/hacking
|
|
|
|
[testenv:lower-constraints]
|
|
deps =
|
|
-c{toxinidir}/lower-constraints.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
-r{toxinidir}/requirements.txt
|
|
.[influxdb,cassandra]
|