magnum-ui/tox.ini
Jake Yip 452ca7da23 Fix tox
tox4 errors if basepython and python in other envs are different. [1]

Bumped tox minversion as allowlist_externals is only supported in 3.18
[2]

[1] https://github.com/tox-dev/tox/issues/2838
[2] https://github.com/tox-dev/tox/issues/2730

Change-Id: I9d24395a7cc5d8423a58ec1e3ed8468ca6984e77
2023-02-17 15:35:00 +11:00

115 lines
3.2 KiB
INI

[tox]
envlist = pep8,eslint,karma-local,docs-local,releasenotes
minversion = 3.18
skipsdist = True
ignore_basepython_conflict=true
[testenv]
basepython = python3
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
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:TOX_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=magnum_ui.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]
commands = flake8 {posargs}
[flake8]
# F405 TEMPLATES may be undefined, or defined from star imports
# (because it is not easy to avoid this in openstack_dashboard.test.settings)
ignore = F405,W504
exclude = .git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules
max-complexity = 20
[testenv:cover]
commands =
coverage erase
coverage run {toxinidir}/manage.py test magnum_ui --settings=magnum_ui.test.settings {posargs} --exclude-dir=magnum_ui/test/integration_tests {posargs}
coverage xml --omit '.tox/cover/*' -o 'cover/coverage.xml'
coverage html --omit '.tox/cover/*' -d 'cover/htmlcov'
# NOTE(shu-mutow): On CI infra, horizon will be installed
# according to job setting. but on local, we need to install
# horizon from master branch.
[testenv:py36-local]
basepython = python3.6
commands =
{[testenv:hz-local]commands}
{[testenv]commands}
[testenv:eslint]
allowlist_externals =
npm
commands =
npm install
npm run lint
# NOTE(shu-mutow): The "postinstall" script on package.json will install horizon
# from master branch into karma environment with python3.x for testing javascripts.
# Horizon from master is needed to be cloned into ../horizon on both local and CI.
[testenv:karma]
allowlist_externals =
{[testenv:eslint]allowlist_externals}
commands =
npm install
npm run test
[testenv:karma-local]
allowlist_externals =
{[testenv:eslint]allowlist_externals}
commands =
{[testenv:karma]commands}
[testenv:docs]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
# magnum-ui doc generated the module reference,
# so requirements.txt should be here to apply upper-constraints.
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands=
sphinx-build -W -b html doc/source doc/build/html
[testenv:pdf-docs]
deps = {[testenv:docs]deps}
allowlist_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:docs-local]
deps =
{[testenv:docs]deps}
commands=
{[testenv:hz-local]commands}
{[testenv:docs]commands}
[testenv:releasenotes]
deps =
{[testenv:docs]deps}
commands =
sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
# dummy