Files
Edward Hope-Morley dc50bdf2b5 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 and src/tox.ini

Change-Id: Ida2e8f511fc0df0e72ff021c5fa43bec7c784ba9
Signed-off-by: Edward Hope-Morley <edward.hope-morley@canonical.com>
2026-06-09 22:00:33 +01:00

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