Skip to content
Snippets Groups Projects
tox.ini 4.92 KiB
Newer Older
  • Learn to ignore specific revisions
  • envlist = py3,linters
    
    ignore_basepython_conflict = True
    
    
    [testenv]
    
    basepython = python3
    
    usedevelop = True
    
    Michal Nasiadka's avatar
    Michal Nasiadka committed
    allowlist_externals = bash
    
    Steven Dake's avatar
    Steven Dake committed
                          rm
    
    deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/2024.2}
    
           -r{toxinidir}/requirements.txt
    
    Borne Mace's avatar
    Borne Mace committed
           -r{toxinidir}/test-requirements.txt
    
           podman>=4.3.0,<5
    
    Michal Nasiadka's avatar
    Michal Nasiadka committed
    passenv = http_proxy,HTTP_PROXY,https_proxy,HTTPS_PROXY,no_proxy,NO_PROXY, \
              OS_STDOUT_CAPTURE,OS_STDERR_CAPTURE,OS_LOG_CAPTURE,OS_TEST_TIMEOUT, \
              PYTHON,OS_TEST_PATH,LISTOPT,IDOPTION
    
    commands =
    
      find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
    
      find . -type d -name "__pycache__" -delete
    
    Michal Nasiadka's avatar
    Michal Nasiadka committed
      bash {toxinidir}/tests/link-module-utils.sh {toxinidir} {envsitepackagesdir}
    
    Vu Cong Tuan's avatar
    Vu Cong Tuan committed
      stestr run --slowest {posargs}
    
    [testenv:debug]
    
    commands = oslo_debug_helper -t tests {posargs}
    
    [testenv:cover]
    setenv = VIRTUAL_ENV={envdir}
             NOSE_WITH_COVERAGE=1
             NOSE_COVER_BRANCHES=1
             NOSE_COVER_HTML=1
             NOSE_COVER_HTML_DIR={toxinidir}/cover
    
             PYTHON=coverage run --source kolla_ansible,ansible/action_plugins,ansible/library,ansible/module_utils,ansible/roles/keystone/files/ --parallel-mode
    
    Vu Cong Tuan's avatar
    Vu Cong Tuan committed
    commands =
    
    Michal Nasiadka's avatar
    Michal Nasiadka committed
      bash {toxinidir}/tests/link-module-utils.sh {toxinidir} {envsitepackagesdir}
    
      stestr run {posargs}
      coverage combine
      coverage html -d cover
      coverage xml -o cover/coverage.xml
    
      coverage report --show-missing
    
    [testenv:venv]
    
      -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/2024.2}
    
      -r{toxinidir}/requirements.txt
    
      -r{toxinidir}/doc/requirements.txt
    
    commands = {posargs}
    
    
    skip_install = true
    
      -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/2024.2}
    
      -r{toxinidir}/doc/requirements.txt
    
      rm -rf doc/build/html
    
      {[testenv:docs-iterative]commands}
    
    [testenv:docs-iterative]
    envdir = {toxworkdir}/docs
    skip_install = {[testenv:docs]skip_install}
    deps = {[testenv:docs]deps}
    commands =
    
      sphinx-build -n -W --keep-going -b html doc/source doc/build/html
    
      whereto doc/source/_extra/.htaccess doc/test/redirect-tests.txt
    
    [testenv:deploy-guide]
    
    skip_install = {[testenv:docs]skip_install}
    
    deps = {[testenv:docs]deps}
    
      rm -rf deploy-guide/build/html
      sphinx-build -n -W --keep-going -b html deploy-guide/source deploy-guide/build/html
    
    Mark Goddard's avatar
    Mark Goddard committed
    [testenv:pdf-docs]
    
    allowlist_externals = make
    
    Michal Nasiadka's avatar
    Michal Nasiadka committed
                          rm
    
    skip_install = {[testenv:docs]skip_install}
    
    Mark Goddard's avatar
    Mark Goddard committed
    deps = {[testenv:docs]deps}
    commands =
    
      rm -rf doc/build/pdf
      sphinx-build -n -W --keep-going -b latex doc/source doc/build/pdf
    
    Mark Goddard's avatar
    Mark Goddard committed
      make -C doc/build/pdf
    
    
    Steven Dake's avatar
    Steven Dake committed
    [testenv:releasenotes]
    
    skip_install = {[testenv:docs]skip_install}
    
    deps = {[testenv:docs]deps}
    
    Steven Dake's avatar
    Steven Dake committed
    commands =
    
      rm -rf releasenotes/build/html
      sphinx-build -n -W --keep-going -b html releasenotes/source releasenotes/build/html
    
    Steven Dake's avatar
    Steven Dake committed
    
    
    [testenv:linters]
    # Env vars and deps need to be defined in top level tox env
    setenv =
      ANSIBLE_LIBRARY = {toxinidir}/ansible/library
      ANSIBLE_ACTION_PLUGINS = {toxinidir}/ansible/action_plugins
      ANSIBLE_FILTER_PLUGINS = {toxinidir}/ansible/filter_plugins
    
      ANSIBLE_ROLES_PATH = {toxinidir}/ansible/roles
    
    deps =
    
      -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/2024.2}
    
      -r{toxinidir}/requirements.txt
    
      -r{toxinidir}/lint-requirements.txt
    
    allowlist_externals = bash
                          find
    
    commands =
      {[testenv:pep8]commands}
      {[testenv:doc8]commands}
      {[testenv:bandit]commands}
      {[testenv:bashate]commands}
    
      {[testenv:j2lint]commands}
    
      {[testenv:yamllint]commands}
      {[testenv:ansible-lint]commands}
    
    [testenv:pep8]
    deps = {[testenv:linters]deps}
    commands =
      flake8 {posargs}
    
    Michal Nasiadka's avatar
    Michal Nasiadka committed
      codespell -I {toxinidir}/.codespell-ignore
    
    Borne Mace's avatar
    Borne Mace committed
    [flake8]
    show-source = True
    
    # NOTE: Default ignore list is *not* empty!
    # W504 line break after binary operator
    
    gugug's avatar
    gugug committed
    # (W503 and W504 are incompatible and we need to choose one of them.
    #  Existing codes follows W503, so we disable W504.):
    ignore = W504
    
    exclude = .eggs,.git,.tox,doc
    
    [testenv:doc8]
    deps = {[testenv:linters]deps}
    commands =
      doc8 doc/source
    
    Radosław Piliszek's avatar
    Radosław Piliszek committed
      reno lint
    
      doc8 -e '.yaml' releasenotes/notes/
    
    [testenv:bashate]
    deps = {[testenv:linters]deps}
    commands =
      bash -c "{toxinidir}/tools/run-bashate.sh"
    
    [testenv:bandit]
    # B303: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
    deps = {[testenv:linters]deps}
    commands = bandit --skip B303 -r ansible kolla_ansible tests tools
    
    
    [testenv:j2lint]
    deps = {[testenv:linters]deps}
    commands =
      find {toxinidir} -type f -name "*.j2" -not -path "*/.tox/*" -exec {toxinidir}/tests/j2lint.py \{\} +
    
    
    [testenv:ansible-lint]
    # Lint only code in ansible/* - ignore tests/ and roles/ used by CI
    setenv = {[testenv:linters]setenv}
    deps = {[testenv:linters]deps}
    commands =
      python {toxinidir}/tools/validate-all-file.py
    
      ansible-lint -p --exclude {toxinidir}/tests --exclude {toxinidir}/roles --exclude {toxinidir}/etc
    
    
    [testenv:yamllint]
    deps = {[testenv:linters]deps}
    commands = yamllint -s .