tox.ini needs to have env for specific Python versions as this is needed by the CI Zuul jobs, e.g., py310, py312 etc. Since we are using the same CI cleanup procedure as with other charms, this may also modify requirements files, so we re-generate them to be sure they are in sync. Also adds HOME to tox passenv as it is needed for zaza/functests. Change-Id: I17ab9bd1dacb8ca1a78def8452b7625b22f354f0 Signed-off-by: Munir Siddiqui <munir.siddiqui@canonical.com>
132 lines
3.5 KiB
INI
132 lines
3.5 KiB
INI
# Classic charm (with zaza): ./tox.ini
|
|
# This file is managed centrally by release-tools and should not be modified
|
|
# within individual charm repos. See the 'global' dir contents for available
|
|
# choices of tox.ini for OpenStack Charms:
|
|
# https://github.com/openstack-charmers/release-tools
|
|
|
|
[tox]
|
|
envlist = pep8,py3
|
|
# NOTE: Avoid build/test env pollution by not enabling sitepackages.
|
|
sitepackages = False
|
|
# NOTE: Avoid false positives by not skipping missing interpreters.
|
|
skip_missing_interpreters = False
|
|
|
|
[testenv]
|
|
basepython = python3.12
|
|
# We use tox mainly for virtual environment management for test requirements
|
|
# and do not install the charm code as a Python package into that environment.
|
|
# Ref: https://tox.wiki/en/latest/config.html#skip_install
|
|
skip_install = True
|
|
setenv = VIRTUAL_ENV={envdir}
|
|
PYTHONHASHSEED=0
|
|
passenv =
|
|
HOME
|
|
CS_*
|
|
OS_*
|
|
TEST_*
|
|
# The following are needed for building in environments that use a proxy
|
|
# for external access.
|
|
http_proxy
|
|
https_proxy
|
|
no_proxy
|
|
allowlist_externals =
|
|
charmcraft
|
|
deps =
|
|
-c {env:TEST_CONSTRAINTS_FILE:https://raw.githubusercontent.com/openstack-charmers/zaza/master/constraints-juju36.txt}
|
|
-r{toxinidir}/merged-requirements-py312.txt
|
|
|
|
[testenv:update-requirements]
|
|
basepython = python3.12
|
|
deps = pip-tools
|
|
commands =
|
|
pip-compile --unsafe-package juju --unsafe-package kubernetes --output-file=test-requirements-py312.txt test-requirements.in
|
|
pip-compile --unsafe-package juju --unsafe-package kubernetes --output-file=merged-requirements-py312.txt requirements.in test-requirements.in
|
|
|
|
[testenv:update-requirements-functests]
|
|
basepython = python3.10
|
|
deps = pip-tools
|
|
commands =
|
|
pip-compile --unsafe-package juju --unsafe-package kubernetes --output-file=test-requirements-py310.txt test-requirements.in
|
|
|
|
[testenv:build]
|
|
deps =
|
|
# charmcraft clean is done to ensure that
|
|
# `tox -e build` always performs a clean, repeatable build.
|
|
# For faster rebuilds during development,
|
|
# directly run `charmcraft -v pack
|
|
commands =
|
|
charmcraft clean
|
|
charmcraft -v pack
|
|
charmcraft clean
|
|
|
|
[testenv:py3]
|
|
commands = stestr run --slowest {posargs}
|
|
|
|
[testenv:py312]
|
|
commands = stestr run --slowest {posargs}
|
|
|
|
[testenv:pep8]
|
|
deps = -r {toxinidir}/test-requirements-py312.txt
|
|
commands = flake8 {posargs} hooks unit_tests tests actions lib files
|
|
charm-proof
|
|
|
|
[testenv:cover]
|
|
setenv =
|
|
{[testenv]setenv}
|
|
PYTHON=coverage run
|
|
commands =
|
|
coverage erase
|
|
stestr run --slowest {posargs}
|
|
coverage combine
|
|
coverage html -d cover
|
|
coverage xml -o cover/coverage.xml
|
|
coverage report
|
|
|
|
[coverage:run]
|
|
branch = True
|
|
concurrency = multiprocessing
|
|
parallel = True
|
|
source =
|
|
.
|
|
omit =
|
|
.tox/*
|
|
*/charmhelpers/*
|
|
unit_tests/*
|
|
|
|
[testenv:venv]
|
|
commands = {posargs}
|
|
|
|
[testenv:func-noop]
|
|
basepython = python3.10
|
|
deps = -r {toxinidir}/test-requirements-py310.txt
|
|
commands =
|
|
functest-run-suite --help
|
|
|
|
[testenv:func]
|
|
basepython = python3.10
|
|
deps = -r {toxinidir}/test-requirements-py310.txt
|
|
commands =
|
|
functest-run-suite --keep-model
|
|
|
|
[testenv:func-smoke]
|
|
basepython = python3.10
|
|
deps = -r {toxinidir}/test-requirements-py310.txt
|
|
commands =
|
|
functest-run-suite --keep-model --smoke
|
|
|
|
[testenv:func-dev]
|
|
basepython = python3.10
|
|
deps = -r {toxinidir}/test-requirements-py310.txt
|
|
commands =
|
|
functest-run-suite --keep-model --dev
|
|
|
|
[testenv:func-target]
|
|
basepython = python3.10
|
|
deps = -r {toxinidir}/test-requirements-py310.txt
|
|
commands =
|
|
functest-run-suite --keep-model --bundle {posargs}
|
|
|
|
[flake8]
|
|
ignore = E402,E226,W503,W504
|
|
exclude = */charmhelpers
|