2016-01-15 11:38:28 +00:00
|
|
|
[tox]
|
2021-08-13 02:19:22 +00:00
|
|
|
minversion = 3.18.0
|
2023-08-08 08:25:53 +00:00
|
|
|
envlist = py38,pep8
|
2019-11-27 19:39:42 +00:00
|
|
|
# Automatic envs (pyXX) will only use the python version appropriate to that
|
|
|
|
# env and ignore basepython inherited from [testenv] if we set
|
|
|
|
# ignore_basepython_conflict.
|
Solve py37 timeout
Py37 job always reports timeout error recently.
Please see [1] [2] [3].
At first it was suspected that the error was reported
because of the patch [4].
Therefore, Feng Shaohe's patch [5] revoked the merge,
and at this time, disappeared at py37 timeout.
But in fact, this problem is just hidden.
After removing this setting, the job of py37
is actually running on the environment of python 3.6
(community CI default version is 3.6), please see [6]
for detailed reasons.
Therefore, this patch exposes the hidden py37 timeout problem,
and at the same time, found method test_apply_patch_fpga_arq_monitor_job
, think it is the reason of the timeout. The reason I can find
this method is based on the the troubleshooting of tox -epy37 log.
After commenting out this method, I found that tox -epy37 can run
normally and there is no longer a timeout problem.
If you want to test, please ensure that you have a local
python3.7 environment, not 3.6, and execute rm .tox / -rf.
Then execute tox -epy37.
Therefore, the best way is to comment out this method and
restore py37 job at the same time.
If a friend discovers further reasons and solution, this method
can be restored, please refer to [7].
What went wrong in this method?
It is because in the deep call of this method, ThreadWork of
the thread pool will be used, which under Python3.7 will block
the execution of unit tests. For specific reasons, please see
[8] [9].
Reference:
[1]. https://review.opendev.org/#/c/702578/
[2]. https://review.opendev.org/#/c/703049/
[3]. https://review.opendev.org/#/c/703253/
[4]. https://review.opendev.org/#/c/696397/
[5]. https://review.opendev.org/#/c/706911/
[6]. http://eavesdrop.openstack.org/irclogs/%23openstack-infra/%23openstack-infra.2020-02-12.log.html#t2020-02-12T16:46:18
[7]. https://github.com/openstack/cyborg/tree/deed9c822e3dc54a522ede0d8fafda5890075803
[8]. https://review.opendev.org/#/c/707045/5//COMMIT_MSG
[9]. https://github.com/openstack/cyborg/blob/c61dd8c37612c54456184212321c2c63237daac5/cyborg/objects/extarq/ext_arq_job.py#L41
Change-Id: I09db889fe665c6246ec9503af92c909e7d0da24f
2020-02-13 02:48:05 +00:00
|
|
|
ignore_basepython_conflict = True
|
2016-01-15 11:38:28 +00:00
|
|
|
|
|
|
|
[testenv]
|
2020-04-02 00:10:33 +00:00
|
|
|
basepython = python3
|
2016-01-15 11:38:28 +00:00
|
|
|
usedevelop = True
|
2021-08-13 02:19:22 +00:00
|
|
|
allowlist_externals =
|
2020-09-29 02:45:38 +00:00
|
|
|
bash
|
2020-09-18 02:43:37 +00:00
|
|
|
find
|
2019-10-03 07:50:45 +00:00
|
|
|
rm
|
2020-09-18 02:43:37 +00:00
|
|
|
env
|
2019-10-03 07:50:45 +00:00
|
|
|
make
|
2016-01-15 11:38:28 +00:00
|
|
|
setenv =
|
2017-08-28 10:03:22 +00:00
|
|
|
VIRTUAL_ENV={envdir}
|
|
|
|
OS_TEST_PATH=cyborg/tests/unit
|
2019-01-04 10:09:03 +00:00
|
|
|
deps =
|
2020-12-25 08:12:02 +00:00
|
|
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
2019-01-04 10:09:03 +00:00
|
|
|
-r{toxinidir}/requirements.txt
|
|
|
|
-r{toxinidir}/test-requirements.txt
|
|
|
|
|
2017-08-28 10:03:22 +00:00
|
|
|
commands = rm -f .testrepository/times.dbm
|
2018-07-09 06:54:45 +00:00
|
|
|
stestr run --slowest {posargs}
|
2017-08-28 10:03:22 +00:00
|
|
|
|
2017-08-25 10:30:15 +00:00
|
|
|
[testenv:genpolicy]
|
|
|
|
sitepackages = False
|
|
|
|
envdir = {toxworkdir}/venv
|
|
|
|
commands =
|
|
|
|
oslopolicy-sample-generator --config-file=tools/config/cyborg-policy-generator.conf
|
|
|
|
|
2017-12-08 02:58:25 +00:00
|
|
|
[testenv:genconfig]
|
|
|
|
sitepackages = False
|
|
|
|
envdir = {toxworkdir}/venv
|
|
|
|
commands =
|
|
|
|
oslo-config-generator --config-file=tools/config/cyborg-config-generator.conf
|
|
|
|
|
2019-08-05 06:30:14 +00:00
|
|
|
[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, and develop mode disabled
|
|
|
|
# explicitly to avoid unnecessarily installing the checked-out repo too (this
|
|
|
|
# further relies on "tox.skipsdist = True" above).
|
|
|
|
deps = bindep
|
|
|
|
commands = bindep test
|
|
|
|
usedevelop = False
|
|
|
|
|
2016-01-15 11:38:28 +00:00
|
|
|
[testenv:pep8]
|
2020-09-18 02:43:37 +00:00
|
|
|
description =
|
|
|
|
Run style checks.
|
|
|
|
envdir = {toxworkdir}/shared
|
Fix pep8 error in cyborg/*.py and add Forbidden class
This patch will first fix pep8 error in cyborg/*.py, but except
the sub dir, like cyborg/api*、cyborg/cmd/*...., these code will
be fixed in the follow patch.
This patch does two things:
1. Add Forbidden class in cyborg/common/excpetion.py and modify
NotAuthorized class、HTTPForbidden class.
For the cyborg/context.py, There is no exception called Forbidden
in the cyborg library. I guess this part of the code is referenced
to nova[1]. However, in the nova library [2], they define a Forbidden
class, so we can also defined class Forbidden in cyborg/common/exception.py,
and import it in the format of pep8.
At the same time, the content defined by NotAuthorized and
HTTPForbidden is inconsistent with the effect it wants to
achieve, so NotAuthorized and HTTPForbidden are modified here.
2. Adjust the import order in cyborg/quota.py.
[1]. https://github.com/openstack/nova/blob/master/nova/context.py#L300
[2]. https://github.com/openstack/nova/blob/master/nova/exception.py#L162
Change-Id: Ia7b22272412b5e5fe6a5fa0cdf06fff7870bc07d
2019-08-28 11:50:14 +00:00
|
|
|
commands =
|
2020-09-18 02:43:37 +00:00
|
|
|
bash tools/flake8wrap.sh {posargs}
|
|
|
|
# Check that all JSON files don't have \r\n in line.
|
|
|
|
bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
|
|
|
|
# Check that all included JSON files are valid JSON
|
|
|
|
bash -c '! find doc/ -type f -name *.json | grep -v 'curl' | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
|
|
|
|
bash tools/check-cherry-picks.sh
|
|
|
|
doc8 doc/source/ CONTRIBUTING.rst HACKING.rst README.rst
|
2016-01-15 11:38:28 +00:00
|
|
|
|
2020-09-29 02:45:38 +00:00
|
|
|
[testenv:fast8]
|
|
|
|
description =
|
|
|
|
Run style checks on the changes made since HEAD~. For a full run including docs, use 'pep8'
|
|
|
|
envdir = {toxworkdir}/shared
|
|
|
|
commands =
|
|
|
|
bash tools/flake8wrap.sh -HEAD
|
|
|
|
|
2016-01-15 11:38:28 +00:00
|
|
|
[testenv:venv]
|
|
|
|
commands = {posargs}
|
|
|
|
|
|
|
|
[testenv:cover]
|
2018-07-09 06:54:45 +00:00
|
|
|
setenv =
|
2019-10-24 12:34:12 +00:00
|
|
|
PYTHON=coverage run --source cyborg --parallel-mode
|
2018-07-09 06:54:45 +00:00
|
|
|
commands =
|
2021-07-01 08:44:22 +00:00
|
|
|
coverage erase
|
2018-10-21 14:43:30 +00:00
|
|
|
stestr run {posargs}
|
2018-07-09 06:54:45 +00:00
|
|
|
coverage combine
|
|
|
|
coverage html -d cover
|
|
|
|
coverage xml -o cover/coverage.xml
|
2019-10-24 12:34:12 +00:00
|
|
|
coverage report
|
2016-01-15 11:38:28 +00:00
|
|
|
|
2018-05-10 02:30:49 +00:00
|
|
|
[doc8]
|
|
|
|
ignore-path = .venv,.git,.tox,*cyborg/locale*,*lib/python*,*cyborg.egg*,api-ref/build,doc/build,doc/source/contributor/api
|
|
|
|
|
|
|
|
|
2016-01-15 11:38:28 +00:00
|
|
|
[testenv:docs]
|
2020-11-17 09:57:18 +00:00
|
|
|
description =
|
|
|
|
Build main documentation.
|
2022-12-31 02:44:23 +00:00
|
|
|
allowlist_externals =
|
|
|
|
sphinx-build
|
|
|
|
rm
|
2020-11-17 06:10:22 +00:00
|
|
|
deps =
|
2020-12-25 08:12:02 +00:00
|
|
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
2020-11-17 06:10:22 +00:00
|
|
|
-r{toxinidir}/doc/requirements.txt
|
2017-12-08 02:58:25 +00:00
|
|
|
commands =
|
2019-10-03 07:50:45 +00:00
|
|
|
rm -rf doc/build/html
|
2018-08-10 08:53:34 +00:00
|
|
|
sphinx-build -W -b html doc/source doc/build/html
|
2016-01-15 11:38:28 +00:00
|
|
|
|
2019-10-03 07:50:45 +00:00
|
|
|
[testenv:pdf-docs]
|
2020-11-17 09:57:18 +00:00
|
|
|
description =
|
|
|
|
Build PDF documentation.
|
2019-10-03 07:50:45 +00:00
|
|
|
envdir = {toxworkdir}/docs
|
|
|
|
deps = {[testenv:docs]deps}
|
|
|
|
commands =
|
|
|
|
rm -rf doc/build/pdf
|
|
|
|
sphinx-build -W -b latex doc/source doc/build/pdf
|
|
|
|
make -C doc/build/pdf
|
|
|
|
|
2018-02-14 06:52:34 +00:00
|
|
|
[testenv:releasenotes]
|
2020-11-17 09:57:18 +00:00
|
|
|
description =
|
|
|
|
Generate release notes.
|
|
|
|
envdir = {toxworkdir}/docs
|
2020-11-17 06:10:22 +00:00
|
|
|
deps = {[testenv:docs]deps}
|
2018-02-14 06:52:34 +00:00
|
|
|
commands = sphinx-build -a -W -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
|
|
|
|
2016-01-15 11:38:28 +00:00
|
|
|
[testenv:debug]
|
2017-12-11 01:04:05 +00:00
|
|
|
commands = oslo_debug_helper -t cyborg/tests {posargs}
|
2016-01-15 11:38:28 +00:00
|
|
|
|
2019-03-20 09:20:35 +00:00
|
|
|
[testenv:api-ref]
|
2020-11-17 09:57:18 +00:00
|
|
|
description =
|
|
|
|
Generate the API ref. Called from CI scripts to test and publish to docs.openstack.org.
|
2019-03-20 09:20:35 +00:00
|
|
|
# This environment is called from CI scripts to test and publish
|
2019-07-22 16:16:43 +00:00
|
|
|
# the API Ref to docs.openstack.org.
|
2020-11-17 09:57:18 +00:00
|
|
|
envdir = {toxworkdir}/docs
|
|
|
|
deps = {[testenv:docs]deps}
|
2019-03-20 09:20:35 +00:00
|
|
|
commands =
|
|
|
|
rm -rf api-ref/build
|
|
|
|
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
|
2021-08-13 02:19:22 +00:00
|
|
|
allowlist_externals = rm
|
2019-03-20 09:20:35 +00:00
|
|
|
|
Fix pep8 error in cyborg/*.py and add Forbidden class
This patch will first fix pep8 error in cyborg/*.py, but except
the sub dir, like cyborg/api*、cyborg/cmd/*...., these code will
be fixed in the follow patch.
This patch does two things:
1. Add Forbidden class in cyborg/common/excpetion.py and modify
NotAuthorized class、HTTPForbidden class.
For the cyborg/context.py, There is no exception called Forbidden
in the cyborg library. I guess this part of the code is referenced
to nova[1]. However, in the nova library [2], they define a Forbidden
class, so we can also defined class Forbidden in cyborg/common/exception.py,
and import it in the format of pep8.
At the same time, the content defined by NotAuthorized and
HTTPForbidden is inconsistent with the effect it wants to
achieve, so NotAuthorized and HTTPForbidden are modified here.
2. Adjust the import order in cyborg/quota.py.
[1]. https://github.com/openstack/nova/blob/master/nova/context.py#L300
[2]. https://github.com/openstack/nova/blob/master/nova/exception.py#L162
Change-Id: Ia7b22272412b5e5fe6a5fa0cdf06fff7870bc07d
2019-08-28 11:50:14 +00:00
|
|
|
[flake8]
|
|
|
|
filename = *.py,app.wsgi
|
2016-01-15 11:38:28 +00:00
|
|
|
show-source = True
|
2020-03-30 14:07:49 +00:00
|
|
|
ignore = E123,E125,H405,W503,W504
|
2016-01-15 11:38:28 +00:00
|
|
|
builtins = _
|
Fix pep8 error in cyborg/*.py and add Forbidden class
This patch will first fix pep8 error in cyborg/*.py, but except
the sub dir, like cyborg/api*、cyborg/cmd/*...., these code will
be fixed in the follow patch.
This patch does two things:
1. Add Forbidden class in cyborg/common/excpetion.py and modify
NotAuthorized class、HTTPForbidden class.
For the cyborg/context.py, There is no exception called Forbidden
in the cyborg library. I guess this part of the code is referenced
to nova[1]. However, in the nova library [2], they define a Forbidden
class, so we can also defined class Forbidden in cyborg/common/exception.py,
and import it in the format of pep8.
At the same time, the content defined by NotAuthorized and
HTTPForbidden is inconsistent with the effect it wants to
achieve, so NotAuthorized and HTTPForbidden are modified here.
2. Adjust the import order in cyborg/quota.py.
[1]. https://github.com/openstack/nova/blob/master/nova/context.py#L300
[2]. https://github.com/openstack/nova/blob/master/nova/exception.py#L162
Change-Id: Ia7b22272412b5e5fe6a5fa0cdf06fff7870bc07d
2019-08-28 11:50:14 +00:00
|
|
|
enable-extensions = H106,H203,H904
|
2019-08-31 11:48:19 +00:00
|
|
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,*sqlalchemy/alembic/versions/*,demo/,releasenotes
|
2018-08-16 10:07:40 +00:00
|
|
|
|
2019-12-25 10:07:23 +00:00
|
|
|
[testenv:bandit]
|
|
|
|
commands = bandit -r cyborg -x cyborg/tests/* -n 5 -ll
|
|
|
|
|
2020-03-30 14:07:49 +00:00
|
|
|
[flake8:local-plugins]
|
|
|
|
extension =
|
|
|
|
M302 = checks:assert_equal_not_none
|
|
|
|
M310 = checks:use_timeutils_utcnow
|
|
|
|
M316 = checks:assert_true_isinstance
|
|
|
|
M322 = checks:no_mutable_default_args
|
|
|
|
M336 = checks:dict_constructor_with_list_copy
|
|
|
|
M338 = checks:assert_equal_in
|
|
|
|
M339 = checks:no_xrange
|
|
|
|
M340 = checks:check_explicit_underscore_import
|
|
|
|
M352 = checks:no_log_warn
|
2020-04-02 10:27:11 +00:00
|
|
|
N366 = checks:import_stock_mock
|
2020-03-30 14:07:49 +00:00
|
|
|
paths = ./cyborg/hacking
|