Files
Munir Siddiqui bed16e4018 Cleanup Master CI
* update:
  - charmcraft.yaml for v3
  - tox.ini to use py3.12 by default
  - test-requirements.in to use zaza for juju3
  - update test bundles to work with charmcraft v3
* generate:
  - merged-requirements-py312.txt
  - test-requirements-py312.txt
* add:
  - update-requirements env to tox.ini
  - required CHARM_DIR env var to unit tests
* delete:
  - .coveragerc as it breaks tox cover test

Change-Id: Ic056ebc2a8e83d14392b2e3a1d69167fd71b8555
Signed-off-by: Munir Siddiqui <munir.siddiqui@canonical.com>
2026-06-09 11:24:17 +05:00

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