[tox]
minversion = 3.18.0
envlist = py3,pep8,eslint,karma

[testenv]
usedevelop = True
setenv =
   VIRTUAL_ENV={envdir}
   CLIENT_NAME=octavia-dashboard
   DJANGO_SETTINGS_MODULE=octavia_dashboard.tests.settings
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
       -r{toxinidir}/requirements.txt
       -r{toxinidir}/test-requirements.txt
allowlist_externals = npm
                      bash
commands =
   python manage.py test octavia_dashboard --settings=octavia_dashboard.tests.settings

[testenv:pep8]
commands = flake8

[testenv:venv]
commands = {posargs}

[testenv:cover]
# npm must be installed on the system, for example
# sudo apt-get install npm
# sudo yum install npm (on RHEL/CentOS, enable EPEL repository)
commands = npm install
           npm test

[testenv:docs]
allowlist_externals = rm
deps =
    -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
    -r{toxinidir}/requirements.txt
    -r{toxinidir}/doc/requirements.txt
commands =
  rm -rf doc/build/html
  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:releasenotes]
allowlist_externals = rm
deps = {[testenv:docs]deps}
commands =
    rm -rf releasenotes/build
    sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html

[testenv:debug]
commands = oslo_debug_helper {posargs}

[testenv:eslint]
# npm must be installed on the system, for example
# sudo apt-get install npm
commands = npm install
           npm run lint

[testenv:karma]
# npm must be installed on the system, for example
# sudo apt-get install npm
commands = npm install
           npm test

[flake8]
# E123, E125 skipped as they are invalid PEP-8.
# F405 TEMPLATES may be undefined, or defined from star imports
# W504 line break after binary operator
# (because it is not easy to avoid this in openstack_dashboard.test.settings)
show-source = True
ignore = E123,E125,F405,W504
builtins = _
exclude=.venv,.git,.tox,.tmp,dist,doc,*lib/python*,*egg,build,node_modules
