diff --git a/.gitea/workflows/006_passing_files.yaml b/.gitea/workflows/006_passing_files.yaml index 9fe4f9b..d6d34a9 100644 --- a/.gitea/workflows/006_passing_files.yaml +++ b/.gitea/workflows/006_passing_files.yaml @@ -10,7 +10,7 @@ jobs: - name: Checkout source code uses: actions/checkout@v4 - - name: Install Python 3.10 # Setup Python inside the runner + - name: Install Python 3.10.12 # Setup Python inside the runner uses: actions/setup-python@v4 with: python-version: '3.10.12' diff --git a/backend/tox.ini b/backend/tox.ini new file mode 100644 index 0000000..b679e45 --- /dev/null +++ b/backend/tox.ini @@ -0,0 +1,54 @@ +[flake8] +max-line-length = 100 + +[tox] +skipsdist = True +skip_missing_interpreters = True +envlist = fmt, lint, unit, integration + +[vars] +all_path = {[vars]src_path} {[vars]tst_path} +src_path = {toxinidir} +tst_path = {toxinidir}/tests/ + +[testenv] +passenv = + PYTHONPATH + CHARM_BUILD_DIR + MODEL_SETTINGS + KUBECONFIG +setenv = + PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path} + PYTHONBREAKPOINT=ipdb.set_trace + PY_COLORS=1 + +[testenv:fmt] +commands = + isort {[vars]all_path} + black {[vars]all_path} +deps = + -r requirements-fmt.txt +description = Apply coding style standards to code + +[testenv:lint] +commands = + codespell {toxinidir}/. --skip {toxinidir}/.git --skip {toxinidir}/.tox \ + --skip {toxinidir}/build --skip {toxinidir}/lib --skip {toxinidir}/venv \ + --skip {toxinidir}/.mypy_cache \ + --skip {toxinidir}/icon.svg --skip *.json.tmpl + # pflake8 wrapper supports config from pyproject.toml + pflake8 {[vars]all_path} + isort --check-only --diff {[vars]all_path} + black --check --diff {[vars]all_path} +deps = + -r requirements-lint.txt +description = Check code against coding style standards + +[testenv:unit] +commands = + coverage run --source={[vars]src_path} \ + -m pytest -vv --tb native {posargs} + coverage report +deps = + -r requirements-unit.txt +description = Run unit tests \ No newline at end of file