Initial commit

This commit is contained in:
2026-02-06 23:52:26 +01:00
commit f1c539519e
14 changed files with 1320 additions and 0 deletions

80
tox.ini Normal file
View File

@@ -0,0 +1,80 @@
# Copyright 2026 Valentin Haudiquet
# See LICENSE file for licensing details.
[tox]
no_package = True
skip_missing_interpreters = True
env_list = format, lint, unit
min_version = 4.0.0
[vars]
src_path = {tox_root}/src
tests_path = {tox_root}/tests
;lib_path = {tox_root}/lib/charms/operator_name_with_underscores
all_path = {[vars]src_path} {[vars]tests_path}
[testenv]
set_env =
PYTHONPATH = {tox_root}/lib:{[vars]src_path}
PYTHONBREAKPOINT=pdb.set_trace
PY_COLORS=1
pass_env =
PYTHONPATH
CHARM_BUILD_DIR
MODEL_SETTINGS
[testenv:format]
description = Apply coding style standards to code
deps =
ruff
commands =
ruff format {[vars]all_path}
ruff check --fix {[vars]all_path}
[testenv:lint]
description = Check code against coding style standards, and static checks
runner = uv-venv-lock-runner
dependency_groups =
lint
unit
integration
commands =
# if this charm owns a lib, uncomment "lib_path" variable
# and uncomment the following line
# codespell {[vars]lib_path}
codespell {tox_root}
ruff check {[vars]all_path}
ruff format --check --diff {[vars]all_path}
pyright {posargs}
[testenv:unit]
description = Run unit tests
runner = uv-venv-lock-runner
dependency_groups =
unit
commands =
coverage run --source={[vars]src_path} -m pytest \
-v \
-s \
--tb native \
{[vars]tests_path}/unit \
{posargs}
coverage report
[testenv:integration]
description = Run integration tests
runner = uv-venv-lock-runner
dependency_groups =
integration
pass_env =
# The integration tests don't pack the charm. If CHARM_PATH is set, the tests deploy the
# specified .charm file. Otherwise, the tests look for a .charm file in the project dir.
CHARM_PATH
commands =
pytest \
-v \
-s \
--tb native \
--log-cli-level=INFO \
{[vars]tests_path}/integration \
{posargs}