From 241c794df72c0e83b20fe0a9c56345caef8a4277 Mon Sep 17 00:00:00 2001 From: Stuart Maxwell Date: Thu, 30 Jan 2025 20:19:07 +1300 Subject: [PATCH 1/2] Better coverage --- pyproject.toml | 4 ++++ uv.lock | 2 ++ 2 files changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 7c87cce..016dd79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,7 @@ test = [ "django-debug-toolbar>=4.4.0", "nox>=2024.4.15", "djpress-example-plugin", + "pytest-cov>=6.0.0", ] docs = [ "cogapp>=3.4.1", @@ -91,6 +92,9 @@ pythonpath = ". example" DJANGO_SETTINGS_MODULE = "config.settings_testing" python_files = "tests.py test_*.py *_tests.py" +[tool.coverage.html] +show_contexts = true + [tool.coverage.run] branch = true include = ["src/djpress/*"] diff --git a/uv.lock b/uv.lock index 03fe15d..928321a 100644 --- a/uv.lock +++ b/uv.lock @@ -324,6 +324,7 @@ test = [ { name = "djpress-example-plugin" }, { name = "nox" }, { name = "pytest" }, + { name = "pytest-cov" }, { name = "pytest-coverage" }, { name = "pytest-django" }, ] @@ -344,6 +345,7 @@ requires-dist = [ { name = "myst-parser", marker = "extra == 'docs'", specifier = ">=4.0.0" }, { name = "nox", marker = "extra == 'test'", specifier = ">=2024.4.15" }, { name = "pytest", marker = "extra == 'test'", specifier = ">=8.3.3" }, + { name = "pytest-cov", marker = "extra == 'test'", specifier = ">=6.0.0" }, { name = "pytest-coverage", marker = "extra == 'test'", specifier = ">=0.0" }, { name = "pytest-django", marker = "extra == 'test'", specifier = ">=4.9.0" }, { name = "sphinx", marker = "extra == 'docs'", specifier = ">=8.1.3" }, From b1031c0c02646a9e8d3179d6520c5dfdc75d89ee Mon Sep 17 00:00:00 2001 From: Stuart Maxwell Date: Fri, 31 Jan 2025 08:09:35 +1300 Subject: [PATCH 2/2] Update justfile --- justfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/justfile b/justfile index 8769698..6b79aa6 100644 --- a/justfile +++ b/justfile @@ -65,13 +65,12 @@ BUILDDIR := "docs/_build" # Run coverage @cov: - {{uv}} coverage run -m pytest - {{uv}} coverage report -m + {{uv}} -m pytest --cov # Run coverage @cov-html: - {{uv}} coverage run -m pytest - {{uv}} coverage html + {{uv}} -m pytest --cov --cov-report=html --cov-context=test + echo Coverage report: file://`pwd`/htmlcov/index.html # Sync the package @sync: