182fb9e2bf
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. Change-Id: Ic9ce79a02488fc40127acb8db9c2f7774fccfcee Signed-off-by: Munir Siddiqui <munir.siddiqui@canonical.com>
102 lines
2.9 KiB
INI
102 lines
2.9 KiB
INI
# Source charm: ./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
|
|
TERM=linux
|
|
CHARM_LAYERS_DIR={toxinidir}/layers
|
|
CHARM_INTERFACES_DIR={toxinidir}/interfaces
|
|
JUJU_REPOSITORY={toxinidir}/build
|
|
passenv =
|
|
CHARM_INTERFACES_DIR
|
|
CHARM_LAYERS_DIR
|
|
JUJU_REPOSITORY
|
|
# 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: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:add-build-lock-file]
|
|
commands =
|
|
charm-build --log-level DEBUG --write-lock-file -o {toxinidir}/build/builds src {posargs}
|
|
|
|
[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} src unit_tests
|
|
|
|
[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}
|
|
|
|
[flake8]
|
|
# E402 ignore necessary for path append before sys module import in actions
|
|
ignore = E402,W503,W504
|