ui-cookiecutter/{{cookiecutter.repo_name}}/tox.ini
Akihiro Motoki 8390e9d6d2 Fix tox-checkbuild CI job
[Changes in zuul configurations]
- playbooks/checkbuild/pre.yaml calls ensure-nodejs role, but the default
  nodejs version defined in ensure-nodejs role is still 6. nodejs6 repo
  is no longer available. This is the cause of the job failure.
  Let's specify nodejs_version used in horizon by default.
- Ensure to install tox globally in the system.
  tox -e checkbuild calls "tox" as the test commands,
  so it needs to be installed globally.
- Specify "python_version" so that zuul ensures to install a required
  version of python interpreter.

[Changes in cookiecutter template]
- hacking version in test-requirements.txt was too old.
  It is updated to use more recent version which horizon uses.
- Update python version to 3.9 in tox.ini.
- Install horizon and its dependencies separately.
  The constraints file contains horizon, so installing horizon along with
  the constraints file results in a version conflict error.

Change-Id: If4bae3fde1f29eeb1d4d43942acc21ff2ef19482
2022-04-12 09:46:36 +09:00

116 lines
3.0 KiB
INI

[tox]
envlist = pep8,py39-local,py3-dj32-local,eslint,karma-local,docs-local,releasenotes
minversion = 2.3.2
skipsdist = True
[testenv]
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
BRANCH_NAME=master
CLIENT_NAME={{cookiecutter.repo_name}}
NOSE_WITH_OPENSTACK=1
NOSE_OPENSTACK_COLOR=1
NOSE_OPENSTACK_RED=0.05
NOSE_OPENSTACK_YELLOW=0.025
NOSE_OPENSTACK_SHOW_ELAPSED=1
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = python manage.py test {posargs} --settings={{cookiecutter.module_name}}.test.settings
# For installation of horizon on local
# NOTICE: this tox.ini requires horizon repository cloned in sibling directory.
[testenv:hz-local]
commands =
pip install -e ../horizon
[testenv:venv]
commands = {posargs}
[testenv:pep8]
basepython = python3
commands = flake8 {posargs}
[flake8]
ignore = F405
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,node_modules
max-complexity = 20
[testenv:cover]
basepython = python3
commands =
coverage erase
coverage run {toxinidir}/manage.py test {{cookiecutter.module_name}} --settings={{cookiecutter.module_name}}.test.settings {posargs} --exclude-dir={{cookiecutter.module_name}}/test/integration_tests {posargs}
coverage xml --omit '.tox/cover/*' -o 'cover/coverage.xml'
coverage html --omit '.tox/cover/*' -d 'cover/htmlcov'
[testenv:py39-local]
basepython = python3.9
commands =
{[testenv:hz-local]commands}
{[testenv]commands}
[testenv:py3-dj32]
basepython = python3
commands =
pip install django>=3.2,<3.3
{[testenv]commands}
[testenv:py3-dj32-local]
basepython = python3
commands =
{[testenv:hz-local]commands}
pip install django>=3.2,<3.3
{[testenv]commands}
[testenv:eslint]
basepython = python3
whitelist_externals =
npm
commands =
npm install
npm run lint
# NOTE(shu-mutow): The "postinstall" script on package.json will install horizon
# from master branch into python3.x environment for testing javascripts.
# Horizon from master is needed to be cloned into ../horizon on both local and CI.
[testenv:karma]
basepython = python3
whitelist_externals =
{[testenv:eslint]whitelist_externals}
commands =
npm install
npm run test
[testenv:karma-local]
basepython = python3
whitelist_externals =
{[testenv:eslint]whitelist_externals}
commands =
{[testenv:karma]commands}
[testenv:docs]
basepython = python3
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands=
sphinx-build -W -b html doc/source doc/build/html
[testenv:docs-local]
basepython = python3
deps =
{[testenv:docs]deps}
commands=
{[testenv:hz-local]commands}
{[testenv:docs]commands}
[testenv:releasenotes]
basepython = python3
deps =
{[testenv:docs]deps}
commands =
sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html