From 6f12da4857cf0214dcf5f90fbe3a9ca35bb9abb4 Mon Sep 17 00:00:00 2001 From: catborise Date: Sat, 3 Oct 2026 18:53:22 +0300 Subject: [PATCH] ci: measure coverage and fail below 50% The test step runs under coverage and reports files that are not fully covered. pyproject.toml holds the configuration and the floor: 51% measured without the live libvirt suite on 2026-10-03, floor 50% to absorb differences between Python versions. With the live suite against a real host the same code is 69% covered. --- .github/workflows/test.yml | 6 ++++-- pyproject.toml | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90d960aa..65ef9239 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,9 +56,11 @@ jobs: - name: Run Django Migrations run: python manage.py migrate --noinput - # Includes the vrtManager tests + # Includes the vrtManager tests; fails below the coverage floor in pyproject.toml - name: Run Test Suite - run: python manage.py test + run: | + coverage run manage.py test + coverage report --skip-covered - name: Validate OpenAPI Schema run: python manage.py spectacular --validate --fail-on-warn --file /dev/null diff --git a/pyproject.toml b/pyproject.toml index 486d282b..960e0712 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,3 +9,11 @@ select = ["E9", "F"] [tool.ruff.lint.per-file-ignores] # Settings overlay: re-exports the base settings by design. "webvirtcloud/settings-dev.py" = ["F403", "F405"] + +[tool.coverage.run] +source = ["."] +omit = [".venv/*", "*/migrations/*", "*/test*.py", "*/tests.py", "manage.py", "webvirtcloud/settings*.py"] + +[tool.coverage.report] +# Measured 51% without the live libvirt suite (2026-10-03); raise as tests grow. +fail_under = 50