cyborg/tox.ini

159 lines
4.6 KiB
INI
Raw Normal View History

[tox]
minversion = 3.18.0
envlist = py38,pep8
# 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
[testenv]
basepython = python3
usedevelop = True
allowlist_externals =
bash
find
rm
env
make
setenv =
VIRTUAL_ENV={envdir}
OS_TEST_PATH=cyborg/tests/unit
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = rm -f .testrepository/times.dbm
stestr run --slowest {posargs}
[testenv:genpolicy]
sitepackages = False
envdir = {toxworkdir}/venv
commands =
oslopolicy-sample-generator --config-file=tools/config/cyborg-policy-generator.conf
[testenv:genconfig]
sitepackages = False
envdir = {toxworkdir}/venv
commands =
oslo-config-generator --config-file=tools/config/cyborg-config-generator.conf
[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
[testenv:pep8]
description =
Run style checks.
envdir = {toxworkdir}/shared
commands =
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
[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
[testenv:venv]
commands = {posargs}
[testenv:cover]
setenv =
PYTHON=coverage run --source cyborg --parallel-mode
commands =
coverage erase
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[doc8]
ignore-path = .venv,.git,.tox,*cyborg/locale*,*lib/python*,*cyborg.egg*,api-ref/build,doc/build,doc/source/contributor/api
[testenv:docs]
description =
Build main documentation.
allowlist_externals =
sphinx-build
rm
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build/html
sphinx-build -W -b html doc/source doc/build/html
[testenv:pdf-docs]
description =
Build PDF documentation.
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
[testenv:releasenotes]
description =
Generate release notes.
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
commands = sphinx-build -a -W -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:debug]
commands = oslo_debug_helper -t cyborg/tests {posargs}
[testenv:api-ref]
description =
Generate the API ref. Called from CI scripts to test and publish to docs.openstack.org.
# This environment is called from CI scripts to test and publish
# the API Ref to docs.openstack.org.
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
allowlist_externals = rm
[flake8]
filename = *.py,app.wsgi
show-source = True
ignore = E123,E125,H405,W503,W504
builtins = _
enable-extensions = H106,H203,H904
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,*sqlalchemy/alembic/versions/*,demo/,releasenotes
[testenv:bandit]
commands = bandit -r cyborg -x cyborg/tests/* -n 5 -ll
[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
N366 = checks:import_stock_mock
paths = ./cyborg/hacking