tacker/tox.ini
Yasufumi Ogawa 500d2eb780 Change tosca-parser and heat-translator install
With devstack, tosca-parser and heat-translator of stable version are
installed via pip as listed in `requirements.txt`. However, we usually
use devsatck for deploying development env, and it's recommended to get
the latest division sometimes. On the other hand, there are not so many
cases using stable ones actually.

This update includes several tricks as following, but most of them are
no need if the two packages have its own devstack script. So, we should
remove the tricks after that as described in TODOs added in the update.

NOTE: As described below, we should update upper-constraints.txt as
following example and upload it to tacker's repo everytime [1] is
updated for the change.

  $ bash devstack/lib/download_upper_consts

* Install packages from cloned git repos in `/opt/stack/` as similar
  to other packages.

* Comment out entries of the two packages in `requirements.txt` and
  `lower-constraints.txt` because no need to install them from here,
  but activate it if you install stable packages.

* To pass tox jobs, add files below.

  * upper-constraints.txt: The two packages are removed from official
    constraints file [1] to skip checking version of stable. This file
    is refreshed everytime running `stack.sh` to catch up the official.

  * requirements-extra.txt: Install the packages from git repo. Without
    separating it from `requirements.txt`, `tox -e lower-constraints`
    is failed.

* Update params in `tox.ini` to activate the modifications above.

[1] https://releases.openstack.org/constraints/upper/master

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
Change-Id: I776137215ea06c8ac54612d13a663349c2e7db7d
2020-12-14 21:32:37 +00:00

140 lines
4.1 KiB
INI

[tox]
envlist = py39,py38,py36,pep8,docs
minversion = 3.1.1
skipsdist = True
ignore_basepython_conflict = True
[testenv]
basepython = python3
# TODO(yasufum) Remove following definitions after tosca-parser and
# heat-translator have its own devstack scripts.
# * `UPPER_CONSTRAINTS_FILE` in setenv
# * `-r{toxinidir}/requirements-extra.txt` in [testenv], [testenv:docs] and
# [testenv:lower-constraints] sections.
setenv = VIRTUAL_ENV={envdir}
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
UPPER_CONSTRAINTS_FILE={toxinidir}/upper-constraints.txt
passenv = UPPER_CONSTRAINTS_FILE
usedevelop = True
whitelist_externals = rm
install_command =
pip install -U {opts} {packages}
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements-extra.txt
-r{toxinidir}/test-requirements.txt
commands =
stestr run --slowest --concurrency 1 {posargs}
[testenv:functional]
setenv = {[testenv]setenv}
commands =
stestr --test-path=./tacker/tests/functional run --slowest {posargs}
[testenv:dsvm-functional]
setenv = {[testenv]setenv}
commands =
stestr --test-path=./tacker/tests/functional run --slowest --concurrency 2 {posargs}
[testenv:debug]
commands = oslo_debug_helper {posargs}
[testenv:debug-py36]
basepython = python3.6
commands = oslo_debug_helper {posargs}
[testenv:debug-py39]
basepython = python3.9
commands = oslo_debug_helper {posargs}
[testenv:pep8]
deps = -r{toxinidir}/doc/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
flake8
doc8 -e .rst doc/source/ CONTRIBUTING.rst HACKING.rst README.rst TESTING.rst
tacker-db-manage check_migration
whitelist_externals = bash
[testenv:i18n]
commands = python ./tools/check_i18n.py ./tacker
[testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt
-r{toxinidir}/requirements-extra.txt
commands =
sphinx-build -W -b html doc/source doc/build/html
oslopolicy-sample-generator --config-file=etc/tacker-policy-generator.conf
[testenv:api-ref]
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
whitelist_externals = rm
[testenv:releasenotes]
deps = -r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:cover]
setenv =
PYTHON=coverage run --source tacker --parallel-mode
UPPER_CONSTRAINTS_FILE={toxinidir}/upper-constraints.txt
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:venv]
commands = {posargs}
[flake8]
# E128 continuation line under-indented for visual indent
# N320 log messages does not translate
# W503 line break before binary operator
# W504 line break after binary operator
ignore = E128,N320,W503,W504
show-source = true
builtins = _
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject
[hacking]
import_exceptions = tacker._i18n
[flake8:local-plugins]
extension =
N320 = checks:validate_log_translations
paths = ./tacker/hacking
[testenv:config-gen]
commands =
oslo-config-generator --config-file=etc/config-generator.conf
[testenv:genpolicy]
commands =
oslopolicy-sample-generator --config-file=etc/tacker-policy-generator.conf
[testenv:lower-constraints]
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements-extra.txt
[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